MySql创建表

create table Customers
(
    CustomersID int unsigned not null auto_increment primary key, //主键,自曾
    Name char(50) not null,
    Address char(120) not null,
    City char(30) not null
)

  
    
1 create table orders
2 (
3 orderID int unsigned not null auto_increment primary key ,
4 customerID int unsigned not null ,
5 amount float ( 6 , 2 ),
6 date date not null
7 )
8
9   create table books
10 (
11 ISBN char ( 13 ) not null primary key ,
12 author char ( 50 ),
13 title char ( 50 ),
14 price float ( 4 , 2 ) // 指定显示宽度和小数点后的位数
15 )
16
17   create table order_itme
18 (
19 orderID int unsigned not null ,
20 isbn char ( 13 ) not null ,
21 quantity tinyint unsigned,
22 primary key (orderID,isbn) // 使用多列组成主键
23
24 )
25
26 create table book_reviews
27 (
28 isbn char ( 13 ) not null primary key ,
29 review text
30 )

你可能感兴趣的:(mysql)