Answer:
given by:
a. select title from book where subject="art";
Explanation:
it returns the all books which match the subject by Art.
b. select name from writes where ISBN in(select ISBN from Book where publisher= " Harding");
Explanation:
at this time name and publisher are as of two different tables first we obtain isbn from book which match the publisher Harding and then as of that we select names beginning writes table
c. select name from writes where ISBN in(select ISBN from Book where subject= " Science");
Explanation:
at this time name and subject are from two unusual tables first we take ISBN from book which matches the topic science and then from that we select names from write table
d. select title from book where ISBN in(select ISBN from writs where Name in (select name from Author where country="U.S"));
Explanation:
at this point titles and country are from two dissimilar tables first we take person's name from Auther which matches the state U.S and then as of that take ISBN on or after writes and then we obtain titles as of book
e. select title, ISBN, publisher from Book where subject="Art" and ISBN in (select ISBN from writes where name in (select name from Auther where country ="U.S"));
Explanation:
at this time titles,ISBN and authers are from two dissimilar tables primary we take name from Auther which match the country U.S and then as of that take ISBN from writes and after that we take titles,ISBN,Publishers from book which matches topic art.
Consider the following relation tables (fields with underline is primary keys): Author(Name, Country) Book(ISBN, Title, Publisher,...
Author(name, address, URL) Book(ISBN, title, year, price, publisher_Name) WrittenBy(name, address, ISBN) Publisher(name, address, phone, URL) Warehouse(code, phone, address) Stocks(ISBN, WH_code, number) Shopping-Basket(basketID, email) basketContains(ISBN, basketID, number) Customer(email, name, address, phone) Referring to the relational model in slide 15 in"ER-mapping" (about author, publisher, shopping-basket, provide the algebraic pressing for the following queries Q1: Report the book title, and year for the books that have been written by exactly 2 authors, one of them is Mark Smith" Q2: For each customer,...
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 keep it simple, most of the attributes have been truncated in the sample database. 1 trivial dependencies are things like X→X or...
c) Write an ER Diagram for the following Library database. Identify all the Entities, Relationships and Attributes. Underline the primary keys and mark the different constraints. You can add an I attribute as a primary key for an entity to make t unique if necessary. Library has a number of branches in the city, each branch having a name, address and librarian. Books have title, authors and publisher. A book can have multiple authors but a single publisher. Note that same...
Consider the following table schemas (primary keys are underlined): Book (BookId, Title, Publishername) Book_Authors (BookId, AuthorName) Publisher (Name, Address, Phone) Book_Copies (BookId, BranchId, No_Of_Copies) Book_Loans (BookId, BranchId, CardNo, DateOut, DueDate) Library_Branch (BranchId, BranchName, Address) Borrower (CardNo, Name, Address, Phone) Write SQL statements for the following queries: List the number of copies of the book titled “The Lost Tribe” owned by each library branch and the corresponding library branch name. List the names and addresses of all borrowers who have borrowed more than 5 books...
Give an example of 3 relations illustrating primary keys and foreign keys. Consider the following relations: Student(sID, surName, firstName, campus, email) Course(dept, cNum, name) Offering(oID, dept, cNum, term, instructor) Took(sID, oID, grade) Such as: Offering[dept, cNum] ⊆ Course[dept, cNum] Took[sID] ⊆ Student[sID] Took[oID] ⊆ Offering[oID] Answer the following query using relational algebra -Give the Student number of all students who have taken the course number “343” by the department “CS”. - Find sID of all students who have earned some...