/*创建顾客表*/
create table if not exists customer(
c_id char(6) primary key,
//为主键,若是需要多个的话,则需要写成primary key(字段一,字段二)
name varchar(30)not null,
//指定了NOT NULL,若插入空值,则会插入失败;而NULL为默认状态,可不写
location varchar(30),
salary decimal(8,2)
);
/*创建银行表*/
create table if not exists bank(
b_id char(5) primary key,
bank_name char(30) not null
);
/*创建存款表(注意外键的代码使用)*/
create table if not exists deposite(
d_id int(10) auto_increment primary key,
c_id char(6),
b_id char(5),
dep_date date,
amount decimal(8,2),
constraint FK_c_id foreign key(c_id) references customer(c_id)
);