1、mysql下建表及插入数据
/* Navicat MySQL Data Transfer Source Server : mysql Source Server Version : 50640 Source Host : localhost:3306 Source Database : test Target Server Type : MYSQL Target Server Version : 50640 File Encoding : 65001 Date: 2018-11-22 18:24:08 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for cource -- ---------------------------- DROP TABLE IF EXISTS `cource`; CREATE TABLE `cource` ( `cno` int(3) unsigned NOT NULL AUTO_INCREMENT COMMENT '课程编号', `cname` varchar(20) DEFAULT NULL COMMENT '课程名称', PRIMARY KEY (`cno`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='课程表'; -- ---------------------------- -- Records of cource -- ---------------------------- INSERT INTO `cource` VALUES ('1', '语文'); INSERT INTO `cource` VALUES ('2', '数学'); INSERT INTO `cource` VALUES ('3', '英语'); -- ---------------------------- -- Table structure for score -- ---------------------------- DROP TABLE IF EXISTS `score`; CREATE TABLE `score` ( `sno` int(3) unsigned DEFAULT NULL COMMENT '学生编号', `cno` int(3) unsigned DEFAULT NULL COMMENT '课程编号', `score` int(3) unsigned DEFAULT NULL COMMENT '考试成绩' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='学生成绩表'; -- ---------------------------- -- Records of score -- ---------------------------- INSERT INTO `score` VALUES ('1', '1', '63'); INSERT INTO `score` VALUES ('1', '2', '61'); INSERT INTO `score` VALUES ('2', '1', '80'); -- ---------------------------- -- Table structure for student -- ---------------------------- DROP TABLE IF EXISTS `student`; CREATE TABLE `student` ( `sno` int(3) unsigned NOT NULL AUTO_INCREMENT COMMENT '学生编号', `sname` varchar(20) DEFAULT NULL COMMENT '学生姓名', `sage` int(3) unsigned DEFAULT NULL COMMENT '学生年龄', PRIMARY KEY (`sno`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='学生表'; -- ---------------------------- -- Records of student -- ---------------------------- INSERT INTO `student` VALUES ('1', '周杰伦', '18'); INSERT INTO `student` VALUES ('2', '周润发', '18'); INSERT INTO `student` VALUES ('3', '吴孟达', '25'); INSERT INTO `student` VALUES ('4', '刘德华', '25'); INSERT INTO `student` VALUES ('5', '李连杰', '29');