day 1 学习MySQL数据库作业
- 创建员工表 (工号、姓名、性别、出生日期、入职日期、月薪、职位)
- 思考员工表跟部门表之间有没有关系?如果有是什么关系?如何建立两张表的关系?
1.创建员工表 (工号、姓名、性别、出生日期、入职日期、月薪、职位)
创建员工表
在创建的数据库为hrs下创建员工表
create table tb_staff
(
dno integer not null comment '工号',
dname varchar(20) not null comment '姓名',
dsex varchar(20) not null comment '性别',
ddateb varchar(20) not null comment '出生日期',
ddateen varchar(20) not null comment '入职日期',
dsalary integer not null comment '月薪',
dpost varchar(20) not null comment '职位',
primary key (dno)
)engine=innodb comment='员工表';