SQL加强练习

新建一个数据库,然后在查询中粘贴以下内容建立数据表并插入数据

score表

CREATE TABLE `score` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `stu_id` int(10) NOT NULL,
  `c_name` varchar(20) DEFAULT NULL,
  `grade` int(10) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;

INSERT INTO `score` VALUES ('1', '901', '计算机', '98');
INSERT INTO `score` VALUES ('2', '901', '英语', '80');
INSERT INTO `score` VALUES ('3', '902', '计算机', '65');
INSERT INTO `score` VALUES ('4', '902', '中文', '88');
INSERT INTO `score` VALUES ('5', '903', '中文', '95');
INSERT INTO `score` VALUES ('6', '904', '计算机', '70');
INSERT INTO `score` VALUES ('7', '904', '英语', '92');
INSERT INTO `score` VALUES ('8', '905', '英语', '94');
INSERT INTO `score` VALUES ('9', '906', '计算机', '90');
INSERT INTO `score` VALUES ('10', '906', '英语', '85');

继续阅读→