Home > database >  Novice mySQL query won't not even any ideas?
Novice mySQL query won't not even any ideas?

Time:09-19

/* topic please look at picture
SQLyog enterprise edition - MySQL GUI v8.14
MySQL - 5.0.22 - community - nt: Database - tedu
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/


/*! 40101 SET NAMES utf8 */;

/*! 40101 SET SQL_MODE='*/;

/*! 40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*! 40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*! 40101 SET @ OLD_SQL_MODE=@ @ SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */.
/*! 40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE/*! 32312 IF NOT EXISTS */` tedu `/*! 40100 DEFAULT CHARACTER SET utf8 */;

USE ` tedu `;

/* Table structure for Table ` class ` */

DROP TABLE IF the EXISTS ` class `;

The CREATE TABLE ` class ` (
` cla_id ` int (11) NOT NULL,
` cla_name ` varchar (20) NOT NULL,
` cla_hold ` int (11) NOT NULL,
PRIMARY KEY (` cla_id `)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/* Data for the table ` class ` */

The LOCK TABLES ` class ` WRITE;

Insert into ` class ` (` cla_id `, ` cla_name `, ` cla_hold `) values (1, 'software in class 1, 5), (2,' 'software, class 2, 10), (3,' software class 3, 10), (4, '1 meter network class, 5), (5,' 'meter network, class 2, 10), (6,' cartoon in class 1, 5), (7, ' 'anime, class 2, 10);

UNLOCK TABLES;

/* Table structure for Table ` exam ` */

DROP TABLE IF the EXISTS ` exam `;

The CREATE TABLE ` exam ` (
` exam_id ` int (11), NOT NULL auto_increment,
` exam_name ` varchar (30) default NULL,
` exam_time ` datetime default NULL,
` exam_class_id ` int (11) NOT NULL,
PRIMARY KEY (` exam_id `)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/* Data for the table ` exam ` */

The LOCK TABLES ` exam ` WRITE;

insert into `exam`(`exam_id`,`exam_name`,`exam_time`,`exam_class_id`) values (18,'软件班第一次考试1','2018-09-10 00:00:00',1),(19,'软件班第一次考试2','2018-09-10 00:00:00',2),(20,'软件班第一次考试3','2018-09-10 00:00:00',3),(21,'计网班第一次考试1','2018-09-11 00:00:00',4),(22,'计网班第一次考试2','2018-09-11 00:00:00',5),(23,'动漫班第一次考试1','2018-09-12 00:00:00',6),(24,'动漫班第一次考试2','2018-09-12 00:00:00',7),(25,'软件班第二次考试1','2018-10-10 00:00:00',1),(26,'软件班第二次考试2','2018-10-10 00:00:00',2),(27,'软件班第二次考试3','2018-10-10 00:00:00',3),(28,'计网班第二次考试1','2018-10-10 00:00:00',4),(29,'计网班第二次考试2','2018-10-10 00:00:00',5),(30,'动漫班第二次考试1','2018-10-10 00:00:00',6),(31,'动漫班第二次考试2','2018-10-10 00:00:00',7),(32,'软件班第三次考试1','2019-01-10 00:00:00',1),(33,'软件班第三次考试2','2019-01-10 00:00:00',2),(34,'软件班第三次考试3','2019-01-10 00:00:00',3);

UNLOCK TABLES;

/* Table structure for Table ` score ` */

DROP TABLE IF the EXISTS ` score `;

The CREATE TABLE ` score ` (
` score_id ` int (11), NOT NULL auto_increment,
` score_exam_id ` int (11) NOT NULL,
` score_stu_id ` int (11) NOT NULL,
` score_value ` int (11) NOT NULL,
PRIMARY KEY (` score_id `)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/* Data for the table ` score ` */

The LOCK TABLES ` score ` WRITE;

insert into `score`(`score_id`,`score_exam_id`,`score_stu_id`,`score_value`) values (297,18,1,85),(298,32,1,91),(299,19,2,88),(300,26,2,76),(301,33,2,68),(302,27,3,63),(303,21,4,66),(304,28,4,99),(305,30,6,97),(306,18,7,64),(307,25,7,63),(308,20,8,69),(309,27,8,58),(310,33,9,54),(311,28,10,74),(312,29,11,85),(313,23,12,52),(314,30,12,79),(315,18,13,73),(316,25,13,63),(317,26,14,79),(318,19,15,40),(319,26,15,73),(320,33,15,45),(321,20,16,40),(322,34,16,47),(323,21,17,75),(324,31,18,63),(325,23,19,56),(326,30,19,83),(327,29,20,79),(328,22,21,68),(329,29,21,85),(330,19,22,63),(331,26,22,80),(332,33,22,89),(333,20,23,96),(334,27,23,49),(335,34,23,99),(336,19,24,55),(337,20,25,55),(338,27,25,61),(339,34,25,86),(340,22,26,98),(341,29,26,51),(342,23,28,89),(343,30,28,86),(344,31,29,91),(345,23,30,49),(346,30,30,58),(347,28,31,96),(348,19,32,42),(349,26,32,75),(350,33,32,56),(351,19,33,61),(352,26,33,92),(353,33,33,52),(354,19,34,47),(355,27,36,79),(356,20,37,43),(357,34,37,84),(358,26,38,76),(359,20,39,49),(360,24,40,65),(361,31,40,42),(362,22,41,58),(363,29,41,68);

UNLOCK TABLES;

/* Table structure for Table ` student ` */

DROP TABLE IF the EXISTS ` student `;

The CREATE TABLE ` student ` (
` stu_id ` int (11), NOT NULL auto_increment,
` stu_name ` varchar (30) NOT NULL,
` stu_age ` int (11) the default NULL,
` stu_class_id ` int (11) the default NULL,
PRIMARY KEY (` stu_id `)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

/* Data for the table ` student ` */

The LOCK TABLES ` student ` WRITE;

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related