Current location - Training Enrollment Network - Books and materials - SQL for the operation of book management system
SQL for the operation of book management system
1 use SISO

Create table borrowing

(

CNO int is not empty.

BNO int is not empty.

Date time

) Go ahead.

Change table borrowing

Add constraint primary key _CNO primary key (CNO) change table borrowing

Add unique key (CNO) of constraint UQ_CNO.

go to

2 Select the library card number of CNOA and count the number of books borrowed by (*)AS.

Borrow from

CNO group

Have a count (*) > five

3 Select name, class, book B and book borrowing C from card A.

In which a.cno = c.cno, b.bno = c.bno and b.bname = Water Margin.

4 Select CNO, BNO and date from the loan.

Where rdate < getdate () and RETRUN=0.

5 choose BNO, name and author from books.

Where bnamelike“% network% "

6 choose top 1 BNAME from books, the author.

Sort desc by price

7 choose CNO from the loan

Where's BNO?

(choose BNO from the book.

Where bname is similar to "%calculation method%" and bname is not similar to "%calculation method problem set%")

CNO·desc order

8 update borrowing

Set RDATE=RDATE+7.

Where is the class?

(Select a category from the card.

Where CLASS='C0 1')

9 delete BNO from the book

Where BNO is not.

(Choose BNO from the loan)

10 SELCET BNAME author price

From the book

Where BNAME='%__%'

/10 crest clustered index IND_Books_BName on Books(BName)

12 create view v_new as

Select a name from the card.

Where CLASS='C0 1'

Choose a name from a book.

Where's BNO?

(choose BNO from the loan.

Where is CNO?

(Select CNO from the card.

Where CLASS='C0 1'))

go to

13 Select CNO from the loan.

Where bnoin (choose bno, count (*) from where bname in ('calculation method',' combinatorial mathematics'))

Count (*)=2

Ordered by CNO

13 Select CNO from the loan.

Where's BNO?

(choose BNO from the book.

Where bname =' calculation method' and bname =' combinatorial mathematics')

Ordered by CNO

14 Altered List

Add constraint primary key _BNO primary key (BNO)

15. An altered form card

Change the column name varchar( 10)

Change table card

Add the system name varchar(20)