SQL query help

Reply

Join Date: May 2007
Posts: 1
Reputation: narutoman is an unknown quantity at this point 
Solved Threads: 0
narutoman narutoman is offline Offline
Newbie Poster

SQL query help

 
0
  #1
May 18th, 2007
LibraryDB is a database system that keeps track of information concerning the books and their circulation in an imaginary library.

Disclaimer: The data that populates the database are artificially constructed and by no means correspond to actual real-world data.
The schema for the LibraryDB database is given below.
borrow(transactionID, personID*, borrowdate, duedate, returndate)
author(authorID, firstname, middlename, lastname)
book_copy(bookID, bookdescID*)
book(bookdescID, title, subtitle, edition, voltitle, volnumber, language, place, year, isbn, dewey, subjectID*)
borrow_copy(transactionID*, bookID*)
person(personID, firstname, middlename, lastname, address, city, postcode, phonenumber, emailaddress, studentno, idcardno)
publisher(publisherID, publisherfullname)
written_by(bookdescID*, authorID*, role)
published_by(bookdescID*, publisherID*, role)
subject(subjectID, subjecttype)
The primary keys are underlined. The foreign keys are denoted by asterisks (*). Description of the schema
  • person -- keeps track of the people who borrow books from the library. The attributes contain personal and contact information.
  • author -- keeps track of personal information about authors.
  • publisher -- keeps track of the publisher information. To make simple, most of the attributes have been truncated in the sample database.
  • subject -- this relation keeps information about the subjects on which the library collection have books (such as Mathematics, Database, etc)
  • book -- contains information about the books that are available in the library. Every book can have one or more physical copies in the collection. Each book can have one or more authors and it is published by one or more publishers.
  • book_copy -- keeps track of the physical copies of the books in the library collection.
  • borrow -- keeps track of the check-ins and check-outs of the books. Every transaction is done by one person, however may involve with one or more book copies. If there is no return date, it means the book has been checked out but not returned.
  • written_by -- associates books with authors. A book may be associated with several authors and an author may be associated with several books. There is also an attribute 'role' that specifies the role of the author for the book (author/ editor/ translator/ etc).
  • published_by -- associates publishers with books. There is an attribute 'role' here too.
  • borrow_copy -- associates physical copies of books with a transaction. Members are allowed to borrow several books in a single transaction.
I am not sure about how to do this question below
List the full names of publishers who have not published books on ``Databases".
  1. Write your query using NOT IN clause.
  2. Write your query using NOT EXISTS clause.
can someone please tell me how to do this one..

Thank you..
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,857
Reputation: ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all 
Solved Threads: 120
ithelp's Avatar
ithelp ithelp is offline Offline
Posting Virtuoso

Re: SQL query help

 
0
  #2
May 19th, 2007
Try it yourself and post the code and tell us what probem are you facing.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 812
Reputation: arjunsasidharan is on a distinguished road 
Solved Threads: 13
arjunsasidharan's Avatar
arjunsasidharan arjunsasidharan is offline Offline
Practically a Posting Shark

Re: SQL query help

 
0
  #3
May 22nd, 2007
Originally Posted by narutoman View Post
LibraryDB is a database system that keeps track of information concerning the books and their circulation in an imaginary library.

Disclaimer: The data that populates the database are artificially constructed and by no means correspond to actual real-world data.
The schema for the LibraryDB database is given below.
borrow(transactionID, personID*, borrowdate, duedate, returndate)
author(authorID, firstname, middlename, lastname)
book_copy(bookID, bookdescID*)
book(bookdescID, title, subtitle, edition, voltitle, volnumber, language, place, year, isbn, dewey, subjectID*)
borrow_copy(transactionID*, bookID*)
person(personID, firstname, middlename, lastname, address, city, postcode, phonenumber, emailaddress, studentno, idcardno)
publisher(publisherID, publisherfullname)
written_by(bookdescID*, authorID*, role)
published_by(bookdescID*, publisherID*, role)
subject(subjectID, subjecttype)
The primary keys are underlined. The foreign keys are denoted by asterisks (*). Description of the schema
  • person -- keeps track of the people who borrow books from the library. The attributes contain personal and contact information.
  • author -- keeps track of personal information about authors.
  • publisher -- keeps track of the publisher information. To make simple, most of the attributes have been truncated in the sample database.
  • subject -- this relation keeps information about the subjects on which the library collection have books (such as Mathematics, Database, etc)
  • book -- contains information about the books that are available in the library. Every book can have one or more physical copies in the collection. Each book can have one or more authors and it is published by one or more publishers.
  • book_copy -- keeps track of the physical copies of the books in the library collection.
  • borrow -- keeps track of the check-ins and check-outs of the books. Every transaction is done by one person, however may involve with one or more book copies. If there is no return date, it means the book has been checked out but not returned.
  • written_by -- associates books with authors. A book may be associated with several authors and an author may be associated with several books. There is also an attribute 'role' that specifies the role of the author for the book (author/ editor/ translator/ etc).
  • published_by -- associates publishers with books. There is an attribute 'role' here too.
  • borrow_copy -- associates physical copies of books with a transaction. Members are allowed to borrow several books in a single transaction.
I am not sure about how to do this question below
List the full names of publishers who have not published books on ``Databases".
  1. Write your query using NOT IN clause.
  2. Write your query using NOT EXISTS clause.
can someone please tell me how to do this one..

Thank you..
This looks like homework!!.. Sorry we don't do your homework!! Read the daniweb rules.
There is just two ways to live your life.
One is as though nothing is a miracle.
The other is as if everything is.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Database Design
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC