这篇文章给大家分享的是有关mysql中新建表和理清表之间有什么联系的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。/*Navicat MySQL Data TransferSource Server : localhostSource Server Version : 50520Source Host : localhost:3306Source Database : gupaoTarget Server Type : MYSQLTarget Server Version : 50520File Encoding : 65001Date: 2018-07-24 22:42:54*/SET FOREIGN_KEY_CHECKS=0;– —————————— Table structure for baoming– —————————-DROP TABLE IF EXISTS `baoming`;CREATE TABLE `baoming` ( `id` int(11) NOT NULL AUTO_INCREMENT, `sid` int(11) DEFAULT NULL, `kid` int(11) DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;– —————————— Records of baoming– —————————-INSERT INTO `baoming` VALUES (‘1’, ‘1’, ‘1’);INSERT INTO `baoming` VALUES (‘2’, ‘2’, ‘1’);INSERT INTO `baoming` VALUES (‘3’, ‘3’, ‘1’);INSERT INTO `baoming` VALUES (‘4’, ‘4’, ‘2’);INSERT INTO `baoming` VALUES (‘5’, ‘5’, ‘2’);INSERT INTO `baoming` VALUES (‘6’, ‘6’, ‘2’);INSERT INTO `baoming` VALUES (‘7’, ‘7’, ‘3’);INSERT INTO `baoming` VALUES (‘9’, ‘1’, ‘3’);INSERT INTO `baoming` VALUES (’10’, ‘3’, ‘3’);INSERT INTO `baoming` VALUES (’11’, ‘5’, ‘3’);– —————————— Table structure for class– —————————-DROP TABLE IF EXISTS `class`;CREATE TABLE `class` ( `cid` int(11) NOT NULL AUTO_INCREMENT, `level` int(11) DEFAULT NULL, `name` varchar(255) DEFAULT NULL, PRIMARY KEY (`cid`)) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;– —————————— Records of class– —————————-INSERT INTO `class` VALUES (‘1’, ‘1’, ‘班级1’);INSERT INTO `class` VALUES (‘2’, ‘1’, ‘班级2’);INSERT INTO `class` VALUES (‘3’, ‘2’, ‘班级3’);INSERT INTO `class` VALUES (‘4’, ‘3’, ‘班级4’);– —————————— Table structure for ke– —————————-DROP TABLE IF EXISTS `ke`;CREATE TABLE `ke` ( `kid` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) DEFAULT NULL, `tid` int(11) DEFAULT NULL, PRIMARY KEY (`kid`)) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;– —————————— Records of ke– —————————-INSERT INTO `ke` VALUES (‘1’, ‘课程1’, ‘2’);INSERT INTO `ke` VALUES (‘2’, ‘课程2’, ‘1’);INSERT INTO `ke` VALUES (‘3’, ‘课程3’, ‘5’);INSERT INTO `ke` VALUES (‘4’, ‘课程4’, ‘5’);INSERT INTO `ke` VALUES (‘5’, ‘课程0’, ‘0’);INSERT INTO `ke` VALUES (‘6’, ‘课程’, null);免费主机域名— —————————— Table structure for student– —————————-DROP TABLE IF EXISTS `student`;CREATE TABLE `student` ( `sid` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) DEFAULT NULL, `sex` int(11) DEFAULT ‘1’, `cid` int(11) DEFAULT NULL, PRIMARY KEY (`sid`)) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;– —————————— Records of student– —————————-INSERT INTO `student` VALUES (‘1’, ‘学生1’, ‘1’, ‘1’);INSERT INTO `student` VALUES (‘2’, ‘学生2’, ‘1’, ‘1’);I免费主机域名NSERT INTO `student` VALUES (‘3’, ‘学生3’, ‘2’, ‘1’);INSERT INTO `student` VALUES (‘4’, ‘学生4’, ‘2’, ‘1’);INSERT INTO `student` VALUES (‘5’, ‘学生5’, ‘1’, ‘2’);INSERT INTO `student` VALUES (‘6’, ‘学生6’, ‘1’, ‘2’);INSERT INTO `student` VALUES (‘7’, ‘学生7’, ‘2’, ‘2’);INSERT INTO `student` VALUES (‘8’, ‘学生8’, ‘2’, ‘2’);INSERT INTO `student` VALUES (‘9’, ‘学生9’, ‘1’, ‘3’);INSERT INTO `student` VALUES (’10’, ‘学生0’, ‘1’, ‘0’);– —————————— Table structure for teacher– —————————-DROP TABLE IF EXISTS `teacher`;CREATE TABLE `teacher` ( `tid` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) DEFAULT NULL, `sex` int(11) DEFAULT ‘1’, PRIMARY KEY (`tid`)) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;– —————————— Records of teacher– —————————-INSERT INTO `teacher` VALUES (‘1’, ‘教授1’, ‘1’);INSERT INTO `teacher` VALUES (‘2’, ‘教授2’, ‘1’);INSERT INTO `teacher` VALUES (‘3’, ‘教授3’, ‘2’);INSERT INTO `teacher` VALUES (‘4’, ‘教授4’, ‘2’);INSERT INTO `teacher` VALUES (‘5’, ‘大教授’, ‘1’);INSERT INTO `teacher` VALUES (‘6’, ‘助教’, ‘2’);在上课的老师SELECT DISTINCT t.name FROM keJOIN teacher AS t ON ke.tid=t.tid老师和学生的对应关系SELECT * FROM keJOIN teacher AS t ON ke.tid=t.tidJOIN baoming AS b ON ke.kid=b.kidJOIN student AS s ON b.sid=s.sid感谢各位的阅读!关于“mysql中新建表和理清表之间有什么联系”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!
相关推荐: Oracle 12.2如何使用Database Link优化Standby Database Workload
这篇文章将为大家详细讲解有关Oracle 12.2如何使用Database Link优化Standby Database Workload,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。从Oracle 12.2开始,可以通过在…