6 years ago (2015-04-30)  Algorithm language |   First to comment  4 
post score 0 times, average 0.0

This is the EX2 of the SSD7 practice. It is expected that the extreme guests will write a series. The update frequency will be synchronized with the 2013 level progress of the NWPU database system experiment class.Click the tab or search "SSD7" on this site to get the updated SSD7 answer.Previous Exercise: SSD7_EX1 [Relational Database]

Run a given SQL script to create a library database.Note that each row in the Book table refers to a copy of a book. Therefore, if a database has three "DBMSs", then the Book table will have three rows, one for each row. Write SQL statements to accomplish the following operations.(Note: For each operation, you must use a SQL statement to express your query. However, a statement can contain subqueries.) Original: Run the SQL script given to you to create a Library database. Note that each row in the Book table markeds a book copy. Thus, if the Library carries three copies of the title "DBMS", there will be three rows in the Book table, one for each copy. Write the SQL statements to do the following against the database (Note: You must express your query in a single SQL statement for each of the following. However, that statement could have sub-queries.): The homework is still done well by oneself. The following is the result that I do, use for exchange study, do not blindly plagiarize, it is one's own to learn!If the answer is flawed, please correct me. The level is limited and for reference only:

1. List the titles of all books written by "Churchill" and their publication dates.


2. Retrieve the titles of all the books that the members named "John" or "Susan" loaned.


3. List the names and IDs of all members who have already borrowed the books "Iliad" and "Odyssey."


4. List the names and IDs of all members who have already borrowed all the books written by "Collins".Assume that a member may have already borrowed many of the same books.


5. Find the phone numbers of all members who have borrowed a book written by the author of the last name "Tanenbaum"


6. Find out who has borrowed at least three books, and list their names, IDs, and the number of books they have loaned. The results found are sorted by the number of loaned books.


7. List members who did not borrow any books


8. List the names of members of Pittsburgh residents (phone numbers starting with "412") and no and "Pitt Roads" in alphabetical order.



This article has been printed on copyright and is protected by copyright laws. It must not be reproduced without permission.If you need to reprint, please contact the author or visit the copyright to obtain the authorization. If you feel that this article is useful to you, you can click the "Sponsoring Author" below to call the author!

Reprinted Note Source: Baiyuan's Blog>>https://wangbaiyuan.cn/en/ssd7-ex2-sql-2.html

Post comment


No Comment


Forget password?