Current location - Training Enrollment Network - Books and materials - Database theme
Database theme
1, check the library card number and name of the same book as "S070 1026" readers, and select rnno, rnfromreaderwherernoin (select a.

rnofromborrowasa,borrowasbwherea

bno=b

bnoandb

Rno='S070 1026')2。 Inquire the name of each reader and the name of the Borrowed book: Select RN, BNFromreader, borrow, Bookwheeler.

Rno = loan

rnoandborrow

Bno = book

Bno3, check the library card number and name of readers who have not borrowed books, selectrno, rnfromreaderhereenonotin (select rnofromborrow) 4. Query the number of readers who borrowed Data Structure, selecta count (*) from borrowherebno = (selectbnofrombookwhere bn =' data structure') groupbybno5, and check the book numbers of books borrowed by Lili and Zhang Chaoyang.

Borovasa

Rno = (selectrnofromreaderwherern =' Lili') and b

Rno = (selectrnofromreaderwheren =' Zhang Chaoyang') Anda

bno=b

Bno6, query the information of readers with the maximum borrowing limit, select * Fromreaderwhererup = (select max (RUP) from reader) orderbyrudesc 7, query the information of readers with the number of books borrowed reaching 2, select * Fromreaderwherernoin (select Fromrorrowgroup byrnohavingCount (*) >1) 8. Query the name of selectreader, the book number of the borrowed book, and list the readers who have not borrowed books.

rn,bnofromreaderleftjoinborrowonreader

Rno = loan

Rno9。 Query the names of readers who haven't borrowed C Programming (SelectrnFromreaderwheel nonotin = (Selectnfrombookweelen =' C Programming')) 15438+0 1 Inquire about the book numbers of all books borrowed by Li's readers (Selectrnofromborrowherernoin' li%'), and inquire about the book information of the borrowed books with the number beginning with "TP", Selectbnofromborrowwhererebnolike' tp%.

rno,rnfromreader,borrow,bookwherereader

Rno = loan

rnoandborrow

Bno = book

Bnoandbn=' Database Principle and Its Application Course' 14. Count the number of readers in each department, display the name and quantity of the department, select the rde department name, count (*) number from reader group by RDE15, query the book numbers, names and departments of readers with overdue books, and select BNO, RN, RDEFromReader and BorrowWheelreader.

Rno = loan

rnoandrdarnofromborrowasa,borrowasbwherea

Bno=(selectbnofrombookwherebn=' data structure') and b

Bno=(selectbnofrombookwherebn=' operating system tutorial') and

rno=b

Rno 17, check the total number of books in stock, select sum(bnu) from book 18, query the information of readers who borrow books, and select * fromreaderherernoin (selectrnofromborrow).