一、建立数据库
1、建库
mysql> create database mydb8_worker;
mysql> use mydb8_worker;
2、建表
mysql> create table t_worker(department_id int(11) not null comment '部门号', worker_id int(11)primary key not null comment '职工号', worker_date date not null comment '工作时间',wages float(8,2) not null comment '工资', politics varchar(10) not null default '群众'
-> comment '政治面貌',
-> name varchar(20)not null comment'姓名',
-> borth_date date not null comment'出生日期');
3、插入数据
mysql> insert into t_worker values (101,1001,'2015-5-4',7500.00,'群众','张春燕','1990-7-1');
mysql> insert into t_worker values (101,1002,'2019-2-6',5200.00,'团员','李名博','1997-2--8');
mysql> insert into t_worker values (102,1003,'2008-1-4',10500.00,'党员','王博涵','1983-6-8');
mysql> insert into t_worker values (102,1004,'2016-10-10',5500.00,'群众','赵小军','1994-9-5');
mysql> insert into t_worker values (102,1005,'2014-4-1',8800.00,'党员','钱有财','1992-12-30');
mysql> insert into t_worker values (103,1006,'2019-5-5',5500.00,'党员','孙菲菲','1996-9-2');