Home > database >  Create bookDB that database, create table readers, readers in the bookDB that database table books a
Create bookDB that database, create table readers, readers in the bookDB that database table books a

Time:10-11

Create bookDB that database, create table readers, readers in the bookDB that database table books and library table borrow books three tables, after using T_SQL to complete the following sentences,

1, add the price in the books table, and press the two fields, specifications as shown in table 2-14,
2, the price of the book required to limit in the table a book not less than 10 yuan, need to increase a check constraint in the price column,
Readers are supposed to table 3 field if you don't at the intermediate input, the default is 1, increase the default constraints,
In the table 4, asked readers to add a unique constraint, readers student number only,

CodePudding user response:

 - 1. 
The alter table books add price decimal (18, 2)
The alter table books add publisher nvarchar (50)
- 2.
The alter table books add constraint CK_books_price CHECK (price> 10)
3
-The ALTER TABLE readers ADD constraint DF_readers_grade DEFAULT (1) FOR grade;
4
-The ALTER TABLE readers ADD CONSTRAINT UQ_readers_sno UNIQUE (sno);
  • Related