mysql学习(创建数据库 )

mysql学习(创建数据库 ),第1张

mysql学习(创建数据库 )
create  database  lianxi;

use  lianxi;

create table course
(couid char(4),
couname char(10),
teachername char(3)
);

INSERT INTO `course` VALUES ('A001', '英语', '袁圆');
INSERT INTO `course` VALUES ('A002', '高等数学', '谭鹃鹃');
INSERT INTO `course` VALUES ('B001', 'C语言程序设计', '王大强');
INSERT INTO `course` VALUES ('B002', '软件技术基础', '成华');
INSERT INTO `course` VALUES ('C001', 'SQL SERVER', '钟恬');
INSERT INTO `course` VALUES ('C002', 'VB程序设计', '张海');
INSERT INTO `course` VALUES ('C003', 'XML', '殷惠');

create table dep
(depid char(4),
depname char(5),
director char(3),
phone char(11)
);

INSERT INTO `dep` VALUES ('1101', '电子信息系', '吴天露', '08302568968');
INSERT INTO `dep` VALUES ('1002', '畜牧兽医系', '张长辉', '08302569541');
INSERT INTO `dep` VALUES ('1003', '农学园艺系', '陈齐', '08301254896');
INSERT INTO `dep` VALUES ('1004', '建筑工程系', '周洲', '08301478547');
INSERT INTO `dep` VALUES ('1005', '经济管理系', '刘伟', '08302569854');

create table scores
(stuid int,
term char(1),
couid char(4),
score tinyint
);

INSERT INTO `scores` VALUES (20070101, '1', 'A001', 78);
INSERT INTO `scores` VALUES (20070101, '6', 'A002', 89);
INSERT INTO `scores` VALUES (20070101, '3', 'B001', 85);
INSERT INTO `scores` VALUES (20070101, '4', 'B002', 45);
INSERT INTO `scores` VALUES (20070101, '5', 'C001', 78);
INSERT INTO `scores` VALUES (20070101, '2', 'C002', 65);
INSERT INTO `scores` VALUES (20070101, '1', 'C003', 25);
INSERT INTO `scores` VALUES (20070102, '4', 'A001', 89);
INSERT INTO `scores` VALUES (20070102, '5', 'A002', 63);
INSERT INTO `scores` VALUES (20070102, '2', 'B001', 65);
INSERT INTO `scores` VALUES (20070103, '1', 'B002', 87);
INSERT INTO `scores` VALUES (20070103, '3', 'C001', 89);
INSERT INTO `scores` VALUES (20070103, '1', 'C002', 98);
INSERT INTO `scores` VALUES (20070104, '1', 'C003', 98);
INSERT INTO `scores` VALUES (20070104, '2', 'A001', 87);
INSERT INTO `scores` VALUES (20070104, '3', 'A002', 47);
INSERT INTO `scores` VALUES (20070105, '4', 'A001', 85);
INSERT INTO `scores` VALUES (20070105, '5', 'A002', 98);
INSERT INTO `scores` VALUES (20070105, '6', 'B001', 96);
INSERT INTO `scores` VALUES (20070105, '1', 'B002', 87);
INSERT INTO `scores` VALUES (20070106, '1', 'A001', 98);
INSERT INTO `scores` VALUES (20070106, '3', 'A002', 78);
INSERT INTO `scores` VALUES (20070107, '1', 'A001', 47);
INSERT INTO `scores` VALUES (20070107, '1', 'A002', 75);
INSERT INTO `scores` VALUES (20070108, '4', 'A001', 99);
INSERT INTO `scores` VALUES (20070108, '1', 'A002', 87);
INSERT INTO `scores` VALUES (20070109, '1', 'C003', 78);
INSERT INTO `scores` VALUES (20070109, '2', 'C002', 58);
INSERT INTO `scores` VALUES (20070110, '1', 'C001', 68);
INSERT INTO `scores` VALUES (20070110, '1', 'C003', 98);

create table stu
(stuid int,
stuname char(3),
sex enum('男','女'),
birthday date,
rx_score  smallint,  
phone char(12),
class char(8),
depid char(4),
remark varchar(200)
);

INSERT INTO `stu` VALUES (20070101, '张华生', '男', '1989-01-07',400, '13312569854', '07软件技术1', '1001', NULL);
INSERT INTO `stu` VALUES (20070102, '刘雪梅', '女', '1989-01-17',500, '13369586963', '06软件技术1', '1001', NULL);
INSERT INTO `stu` VALUES (20070103, '何东', '男', '1988-07-24',450, '18936589635', '07计算机技术1', '1001', NULL);
INSERT INTO `stu` VALUES (20070104, '康勇', '男', '1987-04-17',430, '18936585745', '07计算机技术2', '1001', NULL);
INSERT INTO `stu` VALUES (20070105, '赵琳', '女', '1990-02-02',470, '18812569635', '06畜牧兽医1', '1002', NULL);
INSERT INTO `stu` VALUES (20070106, '王春', '女', '1990-04-04',480, '134569852635', '06园林技术1', '1003', NULL);
INSERT INTO `stu` VALUES (20070107, '吴苇', '女', '1989-12-23',390, '133698541254', '07建筑工程1', '1004', NULL);
INSERT INTO `stu` VALUES (20070108, '陈飞', '男', '1990-05-06',444, '135698541254', '06文秘', '1005', NULL);
INSERT INTO `stu` VALUES (20070109, '董成山', '男', '1988-02-05',495, '135485214526', '05市场营销', '1005', NULL);
INSERT INTO `stu` VALUES (20070110, '刘小梅', '女', '1990-01-07',505, '18965896352', '06市场营销', '1005', NULL);

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/4666837.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-06
下一篇 2022-11-06

发表评论

登录后才能评论

评论列表(0条)

保存