-- 创建4个表
-- 1、poduction产品表
create table poduction(
pid int not null auto_increment,-- id
pno int null,-- 产品编号
pname varchar(50) null,-- 产品名称
pdate date null,-- 生产日期
primary key(pid)-- 设置pid列主键自增
);
commit;
select * from poduction;
insert into poduction(pno,pname,pdate) values(1,'产品A','2018-11-12'),
(2,'产品B','2017-05-25'),
(3,'产品C','2016-10-06');
commit;
#--------------------------------------------------------------------------------#
-- 2、sales销售人员表
create table sales(
sid int not null auto_increment,
sno int null,-- 销售人员编号
sname varchar(50) null,-- 销售人员姓名
ano int null,-- 代理商编号
primary key(sid)-- 设置sid主键自增
);
commit;
insert into sales(sno,sname,ano) values(1,'小赵',2),
(2,'小钱',2),
(3,'小孙',3),
(4,'小李',1),
(5,'小石',3),
(6,'小刘',1);
commit;
select * from sales;
#--------------------------------------------------------------------------------#
-- 3、agent代理商表
create table agent(
aid int not null auto_increment,
ano int null,-- 代理商编号
aname varchar(100),-- 代理商名称
primary key(aid)-- 设置aid主键自增
);
commit;
insert into agent(ano,aname) values(1,'AAA公司'),
(2,'BB