DDL——学生表——成绩表
CREATE TABLE `result` (
`rid` int(11) NOT NULL AUTO_INCREMENT COMMENT '成绩编号',
`testName` varchar(255) DEFAULT NULL COMMENT '测试名称',
`score` double(4,2) DEFAULT NULL COMMENT '成绩',
`studentId` int(11) DEFAULT NULL COMMENT '学生id',
PRIMARY KEY (`rid`),
KEY `studentId` (`studentId`),
CONSTRAINT `result_ibfk_1` FOREIGN KEY (`studentId`) REFERENCES `student` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;
CREATE TABLE `student` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '学号',
`createDate` datetime DEFAULT NULL,
`userName` varchar(20) DEFAULT NULL,
`pwd` varchar(36) DEFAULT NULL,
`phone` varchar(11) DEFAULT NULL,
`age` tinyint(3) unsigned DEFAULT NULL,
`sex` char(2) DEFAULT '男',
`introduce` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
DML
INSERT INTO `result` VALUES (1, '政治', 96.00, 1);
INSERT INTO `result` VALUES (2, '地理', 86.00, 5);
INSERT INTO `result` VALUES (3, '政治', 77.00, 3);
INSERT INTO `result` VALUES (4, '英语', 99.00, 3);
INSERT INTO `result` VALUES (5, '历史', 22.00, 6);
INSERT INTO `result` VALUES (6, '化学', 69.00, 2);
INSERT INTO `result` VALUES (7, 'Java', 79.00, 5);
INSERT INTO `result` VALUES (8, 'Java', 67.00, 6);
INSERT INTO `result` VALUES (9, '政治', 97.00, 2);
INSERT INTO `result` VALUES (10, '物理', 76.00, 6);
INSERT INTO `result` VALUES (11, '物理', 82.00, 2);
INSERT INTO `result` VALUES (12, '化学', 56.00, 4);
INSERT INTO `student` VALUES (1, '2024-02-25 10:10:10', '赵灵儿', '123', '15612345678', 16, '女', '逍遥哥哥,你终于找到我了。');
INSERT INTO `student` VALUES (2, '2024-02-25 10:10:10', '王语嫣', '123', '15612345678', 17, '女', '慕容复,我和你不共戴天。');
INSERT INTO `student` VALUES (3, '2024-02-25 10:10:10', '龙姑娘', '123', '15612345678', 22, '女', '我想过过过儿过过的日子。');
INSERT INTO `student` VALUES (4, '2024-02-25 10:10:10', '杨过', '123', '15612345678', 18, '男', '一遇杨过误终身。');
INSERT INTO `student` VALUES (5, '2024-02-25 10:10:10', '杨逍', '123', '15612345678', 27, '男', '杨过跟程英的大儿子。');
INSERT INTO `student` VALUES (6, NULL, '黄衣女子', NULL, NULL,
DQL
标签:INSERT,10,INTO,实例,VALUES,result,MySQL,分组,NULL From: https://blog.csdn.net/2301_81107559/article/details/137268982