From 28f6c0a73e21ebf54cfb7cd76df88aa45c203d71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=B8=85=E7=BF=94?= <3371439772@qq.com> Date: Thu, 23 Feb 2023 12:52:53 +0800 Subject: [PATCH 1/4] =?UTF-8?q?myaql=E7=AC=AC=E4=BA=8C=E6=AC=A1=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../\344\275\234\344\270\2322.md" | 347 ++++++++++++++++++ 1 file changed, 347 insertions(+) create mode 100644 "52\347\250\213\345\270\205\347\277\224/\344\275\234\344\270\2322.md" diff --git "a/52\347\250\213\345\270\205\347\277\224/\344\275\234\344\270\2322.md" "b/52\347\250\213\345\270\205\347\277\224/\344\275\234\344\270\2322.md" new file mode 100644 index 0000000..49d5e2f --- /dev/null +++ "b/52\347\250\213\345\270\205\347\277\224/\344\275\234\344\270\2322.md" @@ -0,0 +1,347 @@ +# 作业 +## 第一题 +-- 1、创建数据库test01_company +CREATE database test01_company +use test01_company; +-- 2、创建表格offices +create table offices( +officeCode int, +city varchar(30), +address varchar(50), +country varchar(50), +postalCode VARCHAR(25) + +); + +| -- | 字段名 | 数据类型 | +| ------------------------------------------------------------ | ---------- | ------------- | +| -- | officeCode | int | +| -- | city | varchar(30) | +| -- | address | varchar(50) | +| -- | country | varchar(50) | +| -- | postalCode | varchar(25) | +| -- | | | +| -- 3、创建表格employees | | | +| create table employees( | | | +| empNum int(11), | | | +| lastName VARCHAR(50), | | | +| firstName VARCHAR(50), | | | +| mobile VARCHAR(25), | | | +| `code` int, | | | +| jobTitle VARCHAR(50), | | | +| birth date, | | | +| Note VARCHAR(255), | | | +| Sex VARCHAR(5) | | | +| ); | | | +| -- | | | +| -- | 字段名 | 数据类型 | +| -- | --------- | ------------- | +| -- | empNum | int(11) | +| -- | lastName | varchar(50) | +| -- | firstName | varchar(50) | +| -- | mobile | varchar(25) | +| -- | code | int | +| -- | jobTitle | varchar(50) | +| -- | birth | date | +| -- | Note | varchar(255) | +| -- | Sex | varchar(5) | +| -- | | | +| -- **要求4:**将表employees的mobile字段修改到code字段后面。 | | | +| alter table employees modify mobile VARCHAR(25) after code; | | | +| -- | | | +| -- **要求5:**将表employees的birth字段改名为birthday; | | | +| alter table employees change birth birthday date; | | | +| -- | | | +| -- **要求6:**修改sex字段,数据类型为char(1)。 | | | +| alter table employees modify sex char(1); | | | +| -- | | | +| -- **要求7:**删除字段note; | | | +| alter table employees drop note; | | | +| -- | | | +| -- **要求8:**增加字段名favoriate_activity,数据类型为varchar(100); | | | +| alter table employees add favoriate_activity VARCHAR(100); | | | +| -- | | | +| -- **要求9:**将表employees的名称修改为 employees_info | | | +| alter table employees rename to employees_info; | | | +| -- | | | +| -- ```mysql | | | +| -- | | | +| -- ``` | | | +| -- | | | +| -- | | | +| -- | | | + +## 第二题 + + + +-- 1、创建数据库test02db +create database test02db; + +use test02db; + +-- 2、创建表格pet +drop table pet; +create table pet( +`name` VARCHAR(20), +`owner` VARCHAR(20), + species VARCHAR(20), + sex char(1), + birth year, + death year + +); + +| -- | 字段名 | 字段说明 | 数据类型 | +| ------------------------------------------------------- | ------- | -------- | ----------- | +| -- | name | 宠物名称 | varchar(20) | +| -- | owner | 宠物主人 | varchar(20) | +| -- | species | 种类 | varchar(20) | +| -- | sex | 性别 | char(1) | +| -- | birth | 出生日期 | year | +| -- | death | 死亡日期 | year | +| -- | | | | +| -- 3、添加记录 | | | | +| insert into pet values | | | | +| ('Fluffy','harold','Cat','f',2003,2010), | | | | +| ('Claws','gwen','Cat','m',2004,null), | | | | +| ('Buffy',null,'Dog','f',2009,null), | | | | +| ('Fang','benny','Dog','m',2000,null), | | | | +| ('bowser','diane','Dog','m',2003,2009), | | | | +| ('Chirpy',null,'Bird','f',2008,null); | | | | +| -- | | | | +| -- | name | owner | species | +| -- | ------ | ------ | ------- | +| -- | Fluffy | harold | Cat | +| -- | Claws | gwen | Cat | +| -- | Buffy | | Dog | +| -- | Fang | benny | Dog | +| -- | bowser | diane | Dog | +| -- | Chirpy | | Bird | +| -- | | | | +| -- 4、 添加字段主人的生日owner_birth。 | | | | +| alter table pet add owner_birth int; | | | | +| -- | | | | +| -- 5、 将名称为Claws的猫的主人改为kevin | | | | +| update pet set `owner`='kevin' where name='Claws'; | | | | +| -- | | | | +| -- 6、 将没有死的狗的主人改为duck | | | | +| update pet set `owner`='duck' where death is null; | | | | +| -- | | | | +| -- 7、 查询没有主人的宠物的名字; | | | | +| select `owner` pet WHERE `owner` is null; | | | | +| -- | | | | +| -- 8、 查询已经死了的cat的姓名,主人,以及去世时间; | | | | +| select name,`owner`,death from pet WHERE species='Cat'; | | | | +| -- | | | | +| -- 9、 删除已经死亡的狗 | | | | +| delete from pet where species='Dog' and death='2009'; | | | | +| -- | | | | +| -- 10、查询所有宠物信息 | | | | +| select * from pet; | | | | +| -- | | | | +| -- ```sql | | | | +| -- | | | | +| -- ``` | | | | +| -- | | | | +| -- ## 第3题 | | | | +| -- | | | | + +## 第三题 + +-- 1、创建数据库:test03_company +create database test03_company; + +use test03_company; + +-- ```sql +-- create database test03_company charset utf8; + +-- ``` + +-- 2、在此数据库下创建如下3表,数据类型,宽度,是否为空根据实际情况自己定义。 + +-- A. 部门表(department):部门编号(depid),部门名称(depname),部门简介(deinfo);其中部门编号为主键。 + +-- ```mysql +-- use test03_company ; +create table department( +depid int primary key auto_increment, +depname char(10) not null unique key, +deinfo varchar(200) +); + +-- ``` + +-- B. 雇员表(employee):雇员编号(empid),姓名(name),性别(sex),职称(title),出生日期(birthday),所在部门编号(depid);其中 + +-- * 雇员编号为主键; +-- * 部门编号为外键,外键约束等级为(on update cascade 和on delete set null); + +-- * 性别默认为男; + +-- ```mysql +ALTER DATABASE test03_company CHARACTER SET utf8; +create table employee ( +empid int primary key auto_increment, +`name` varchar(10) not null, +sex enum('男','女') not null default'男', +title varchar(10), +birthday date, +depid int, +foreign key(depid) references department(depid) + +); + +-- + +-- C. 工资表(salary):雇员编号(empid),基本工资(basesalary),职务工资(titlesalary),扣除(deduction)。其中雇员编号为主键。 + +-- 3、给工资表(salary)的雇员编号(empid)增加外键约束,外键约束等级为(on update cascade 和on delete cascade) +create table salary( +empid int primary key, +basesalary double, +titlesalary double, +deduction double, +foreign key(empid) references employee(empid) + +); + +-- 4、添加数据如下: + +-- 部门表: +desc department; +show create table department; +alter table department convert to character set utf8; +insert into department values +(111,'生产部',null), +(222,'销售部',null), + +(333,'人事部','人力资源管理'); + +| -- | 部门编号 | 部门名称 | 部门简介 | +| ----------------------------------------------- | -------- | -------- | ------------ | +| -- | 111 | 生产部 | Null | +| -- | 222 | 销售部 | Null | +| -- | 333 | 人事部 | 人力资源管理 | +| -- | | | | +| -- 雇员表: | | | | +| insert into employee values | | | | +| (1001,'张三','男','高级工程师','1975-1-1',111), | | | | +| (1002,'李四','女','助师','1985-1-1',111), | | | | +| (1003,'王五','男','工程师','1978-11-11',222), | | | | +| (1004,'张六','男','工程师','1999-1-1',222); | | | | +| -- | | | | +| -- | 雇员编号 | 姓名 | 性别 | +| -- | -------- | ---- | ---- | +| -- | 1001 | 张三 | 男 | +| -- | 1002 | 李四 | 女 | +| -- | 1003 | 王五 | 男 | +| -- | 1004 | 张六 | 男 | +| -- | | | | +| -- 工资表: | | | | +| insert into salary values | | | | +| (1001,2200,1100,200), | | | | +| (1002,1200,200,null), | | | | +| (1003,2900,700,200), | | | | +| (1004,1950,700,150); | | | | +| -- | | | | +| -- | 雇员编号 | 基本工资 | 职务工资 | +| -- | -------- | -------- | -------- | +| -- | 1001 | 2200 | 1100 | +| -- | 1002 | 1200 | 200 | +| -- | 1003 | 2900 | 700 | +| -- | 1004 | 1950 | 700 | +| -- | | | | +| -- | | | | +| -- | | | | + +## 第四题 + + + +-- 1、创建一个数据库:test04_school +create database test04_school; + +use test04_school; + +-- 2、创建如下表格 +create table Department( +DepNo int(10) primary key not null unique, +DepName varchar(20) not null, +DepNote varchar(50) + +); + +-- 表1 Department表的定义 + +| -- | **字段名** | **字段描述** | **数据类型** | **主键** | **外键** | **非空** | **唯一** | +| --------------------------------------------------------- | ---------- | ------------ | ------------------ | ---------- | --------- | ---------- | ------------ | +| -- | DepNo | 部门号 | int(10) | 是 | 否 | 是 | 是 | +| -- | DepName | 部门名称 | varchar(20) | 否 | 否 | 是 | 否 | +| -- | DepNote | 部门备注 | Varchar(50) | 否 | 否 | 否 | 否 | +| -- | | | | | | | | +| -- 表2 Teacher表的定义 | | | | | | | | +| create table Teacher( | | | | | | | | +| Number int primary key not null unique, | | | | | | | | +| `Name` varchar(30) not null, | | | | | | | | +| Sex VARCHAR(4), | | | | | | | | +| Birth date, | | | | | | | | +| DepNo int, | | | | | | | | +| Salary float, | | | | | | | | +| Address VARCHAR(100), | | | | | | | | +| foreign key(DepNo) references Department(DepNo) | | | | | | | | +| ); | | | | | | | | +| -- | | | | | | | | +| -- | **字段名** | **字段描述** | **数据类型** | **主键** | **外键** | **非空** | **唯一** | +| -- | ---------- | ------------ | ------------ | -------- | -------- | -------- | -------- | +| -- | Number | 教工号 | int | 是 | 否 | 是 | 是 | +| -- | Name | 姓名 | varchar(30) | 否 | 否 | 是 | 否 | +| -- | Sex | 性别 | varchar(4) | 否 | 否 | 否 | 否 | +| -- | Birth | 出生日期 | date | 否 | 否 | 否 | 否 | +| -- | DepNo | 部门号 | int | 否 | 是 | 否 | 否 | +| -- | Salary | 工资 | float | 否 | 否 | 否 | 否 | +| -- | Address | 家庭住址 | varchar(100) | 否 | 否 | 否 | 否 | +| -- | | | | | | | | +| -- 3、添加记录 | | | | | | | | +| alter table Department convert to character set utf8; | | | | | | | | +| insert into Department VALUES | | | | | | | | +| (601,'软件技术系','软件技术等专业'), | | | | | | | | +| (602,'网络技术系','多媒体技术等专业'), | | | | | | | | +| (603,'艺术设计系','广告艺术设计等专业'), | | | | | | | | +| (604,'管理工程系','连锁经营管理等专业'); | | | | | | | | +| -- | | | | | | | | +| -- | **DepNo** | **DepName** | **DepNote** | | | | | +| -- | --------- | ----------- | ------------------ | | | | | +| -- | 601 | 软件技术系 | 软件技术等专业 | | | | | +| -- | 602 | 网络技术系 | 多媒体技术等专业 | | | | | +| -- | 603 | 艺术设计系 | 广告艺术设计等专业 | | | | | +| -- | 604 | 管理工程系 | 连锁经营管理等专业 | | | | | +| alter table Teacher convert to character set utf8; | | | | | | | | +| insert into Teacher VALUES | | | | | | | | +| (2001,'Tom','女','1970-01-10',602,4500,'四川省绵阳市'), | | | | | | | | +| (2002,'Lucy','男','1983-12-18',601,2500,'北京市昌平区'), | | | | | | | | +| (2003,'Mike','男','1990-06-01',604,1500,'重庆市渝中区'), | | | | | | | | +| (2004,'James','女','1980-10-20',602,3500,'四川省成都市'), | | | | | | | | +| (2005,'Jack','男','1975-05-30',603,1200,'重庆市南岸区'); | | | | | | | | +| -- | | | | | | | | +| -- | **Number** | **Name** | **Sex** | **Birth** | **DepNo** | **Salary** | **Address** | +| -- | ---------- | -------- | ------- | ---------- | --------- | ---------- | ------------ | +| -- | 2001 | Tom | 女 | 1970-01-10 | 602 | 4500 | 四川省绵阳市 | +| -- | 2002 | Lucy | 男 | 1983-12-18 | 601 | 2500 | 北京市昌平区 | +| -- | 2003 | Mike | 男 | 1990-06-01 | 604 | 1500 | 重庆市渝中区 | +| -- | 2004 | James | 女 | 1980-10-20 | 602 | 3500 | 四川省成都市 | +| -- | 2005 | Jack | 男 | 1975-05-30 | 603 | 1200 | 重庆市南岸区 | +| -- | | | | | | | | +| -- 4、用SELECT语句查询Teacher表的所有记录。 | | | | | | | | +| select * from Teacher; | | | | | | | | +| -- | | | | | | | | +| -- ```mysql | | | | | | | | +| -- | | | | | | | | +| -- ``` | | | | | | | | +| -- | | | | | | | | +| -- | | | | | | | | +| -- | | | | | | | | +| -- | | | | | | | | +| -- | | | | | | | | +| -- | | | | | | | | \ No newline at end of file -- Gitee From 9c540674f12858c3defcf55dc282897909728c4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=B8=85=E7=BF=94?= <3371439772@qq.com> Date: Fri, 24 Feb 2023 13:33:43 +0800 Subject: [PATCH 2/4] =?UTF-8?q?mysqlDQl=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DQL\344\275\234\344\270\232.md" | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 "52\347\250\213\345\270\205\347\277\224/DQL\344\275\234\344\270\232.md" diff --git "a/52\347\250\213\345\270\205\347\277\224/DQL\344\275\234\344\270\232.md" "b/52\347\250\213\345\270\205\347\277\224/DQL\344\275\234\344\270\232.md" new file mode 100644 index 0000000..46348f1 --- /dev/null +++ "b/52\347\250\213\345\270\205\347\277\224/DQL\344\275\234\344\270\232.md" @@ -0,0 +1,108 @@ +| ```mysql | | | +| -------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| | [2](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_2) | ## 第1题:员工表 | +| | [3](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_3) | | +| | [4](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_4) | mysql | +| | [5](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_5) | drop table if exists `employee`; | +| | [6](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_6) | create database test charset utf8; | +| | [7](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_7) | #创建employee表 | +| | [8](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_8) | use test; | +| | [9](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_9) | CREATE TABLE employee( | +| | [10](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_10) | id INT, | +| | [11](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_11) | `name` VARCHAR(20), | +| | [12](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_12) | sex VARCHAR(20), | +| | [13](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_13) | tel VARCHAR(20), | +| | [14](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_14) | addr VARCHAR(50), | +| | [15](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_15) | salary FLOAT | +| | [16](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_16) | ); | +| | [17](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_17) | | +| | [18](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_18) | #添加信息 | +| | [19](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_19) | INSERT INTO employee(id,`name`,sex,tel,addr,salary)VALUES | +| | [20](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_20) | (10001,'张一一','男','13456789000','广东韶关',10010.58), | +| | [21](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_21) | (10002,'刘小红','女','13454319000','广东江门',12010.21), | +| | [22](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_22) | (10003,'李四','男','0751-1234567','广东佛山',10040.11), | +| | [23](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_23) | (10004,'刘小强','男','0755-5555555','广东深圳',15010.23), | +| | [24](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_24) | (10005,'王艳','男',NULL,'广东广州',14050.16); | +| | [25](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_25) | | +| | [26](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_26) | \| **id** \| **name** \| **sex** \| **tel** \| **addr** \| **salary** \| | +| | [27](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_27) | \| ------ \| -------- \| ------- \| ------------ \| -------- \| ---------- \| | +| | [28](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_28) | \| 10001 \| 张一一 \| 男 \| 13456789000 \| 广东韶关 \| 10010.58 \| | +| | [29](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_29) | \| 10002 \| 刘小红 \| 女 \| 13454319000 \| 广东江门 \| 12010.21 \| | +| | [30](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_30) | \| 10003 \| 李四 \| 男 \| 0751-1234567 \| 广东佛山 \| 10040.11 \| | +| | [31](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_31) | \| 10004 \| 刘小强 \| 男 \| 0755-5555555 \| 广东深圳 \| 15010.23 \| | +| | [32](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_32) | \| 10005 \| 王艳 \| 女 \| NULL \| 广东广州 \| 14050.16 \| | +| | [33](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_33) | select * from employee; | +| | [34](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_34) | **要求1:**查询出薪资在12000~13000之间的员工信息。 | +| | [35](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_35) | select * from employee where salary between 12000 and 13000; | +| | [36](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_36) | **要求2:**查询出姓“刘”的员工的工号,姓名,家庭住址。 | +| | [37](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_37) | select id,name,addr from employee where name like'刘%'; | +| | [38](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_38) | **要求3:**将“李四”的家庭住址改为“广东韶关” | +| | [39](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_39) | update employee set addr = '广东韶关' where name = '李四'; | +| | [40](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_40) | **要求4:**查询出名字中带“小”的员工 | +| | [41](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_41) | select * from employee where name like '%小%'; | +| | [42](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_42) | **要求5:**查询出薪资高于11000的男员工信息 | +| | [43](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_43) | select * from employee where salary > 11000 and sex ='男'; | +| | [44](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_44) | **要求6:**查询没有登记电话号码的员工 | +| | [45](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_45) | select * from employee where tel is null; | +| | [46](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_46) | **要求7:**查询薪资高于12000或者家是广东深圳、广州的男员工 | +| | [47](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_47) | select * from employee where sex ='男' and (salary > 12000 )or(addr in('广东深圳','广东广州')) ; | +| | [48](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_48) | **要求8:**查询每个员工的年薪,显示“姓名、年薪” | +| | [49](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_49) | select name '姓名',salary '底薪', salary * 12 '年薪' from employee; | +| | [50](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_50) | | +| | [51](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_51) | ## 第2题:国家信息表 | +| | [52](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_52) | | +| | [53](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_53) | countries_info表中存储了国家名称、所属大陆、面积、人口和 GDP 值。 | +| | [54](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_54) | create database test2 charset utf8; | +| | [55](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_55) | use test2; | +| | [56](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_56) | DROP TABLE IF EXISTS `countries_info`; | +| | [57](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_57) | CREATE TABLE `countries_info`( | +| | [58](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_58) | `name` VARCHAR(100), | +| | [59](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_59) | `continent` VARCHAR(100), | +| | [60](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_60) | `area` INT, | +| | [61](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_61) | population INT, | +| | [62](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_62) | gdp BIGINT | +| | [63](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_63) | ); | +| | [64](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_64) | | +| | [65](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_65) | INSERT INTO countries_info VALUES | +| | [66](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_66) | ('Afghanistan','Asia',652230,25500100,20343000000), | +| | [67](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_67) | ('Albania','Europe',28748,2831741,12960000000), | +| | [68](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_68) | ('Algeria','Africa',2381741,37100000,188681000000), | +| | [69](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_69) | ('Andorra','Europe',468,78115,3712000000), | +| | [70](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_70) | ('Angola','Africa',1246700,20609294,100990000000); | +| | [71](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_71) | ``` | +| | [72](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_72) | 表数据样例: | +| | [73](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_73) | | +| | [74](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_74) | ```mysql | +| | [75](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_75) | +-------------+-----------+---------+------------+--------------+ | +| | [76](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_76) | \| name \| continent \| area \| population \| gdp \| | +| | [77](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_77) | +-------------+-----------+---------+------------+--------------+ | +| | [78](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_78) | \| Afghanistan \| Asia \| 652230 \| 25500100 \| 20343000000 \| | +| | [79](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_79) | \| Albania \| Europe \| 28748 \| 2831741 \| 12960000000 \| | +| | [80](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_80) | \| Algeria \| Africa \| 2381741 \| 37100000 \| 188681000000 \| | +| | [81](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_81) | \| Andorra \| Europe \| 468 \| 78115 \| 3712000000 \| | +| | [82](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_82) | \| Angola \| Africa \| 1246700 \| 20609294 \| 100990000000 \| | +| | [83](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_83) | +-------------+-----------+---------+------------+--------------+ | +| | [84](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_84) | select * from countries_info | +| | [85](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_85) | | +| | [86](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_86) | **要求1:** 查询大国 的国家名称、人口和面积。 | +| | [87](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_87) | | +| | [88](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_88) | 如果一个国家满足下述两个条件之一,则认为该国是 大国 : | +| | [89](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_89) | | +| | [90](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_90) | - 面积至少为 300万平方公里(即,3000000 km2) | +| | [91](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_91) | | +| | [92](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_92) | - 人口至少为 2500 万(即 25000000) | +| | [93](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_93) | select name,population,area from countries_info where area > 3000000 or population > 25000000; | +| | [94](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_94) | **要求2:**查询属于亚洲的国家名称、所属大陆、面积、人口和 GDP 值 | +| | [95](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_95) | select * from countries_info where continent = 'Asia' ; | +| | [96](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_96) | **要求3:**查询国土面积不足1万平方公里且人口不走10万人的国家信息 | +| | [97](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_97) | select * from countries_info where area < 10000 and population < 100000; | +| | [98](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_98) | **要求4:**查询国家名字中包含“o“字母的国家信息 | +| | [99](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_99) | select * from countries_info where name like '%o%'; | +| | [100](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_100) | **要求5:**查询GDP值超过10000000000的国家信息 | +| | [101](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_101) | select * from countries_info where gdp > 10000000000; | +| | [102](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_102) | **要求6:**查询每个国家的人均贡献GDP值(GDP/人口总数)并显示为“国家名、人口、GDP值、人均贡献GDP值” | +| | [103](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_103) | select name '国家名', population '人口', gdp 'GDP值',gdp/ population '人均贡献GDP值' from countries_info; | +| | [104](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_104) | **要求7:**查询人均贡献GDP值低于1000的国家信息。 | +| | [105](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_105) | select * from countries_info where gdp / population < 1000; | +| | [106](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_106) | **要求8:**查询每个国家的人均国土面积(面积/人口总数)并显示为“国家名、面积、人口、人均国土面积值” | +| | [107](https://gitee.com/fang-zengxing/mysql-base/commit/79daf0a776910f6cdc1c09a5fdb7a40e1b7b6244#ab8c8689102a3c159b3c030567c88aadfed7d90d_0_107) | select name '国家名',area '面积', population '人口',area/ population '人均国土面积值' from countries_info; | \ No newline at end of file -- Gitee From 9a75157c7cf89a48f99386fba148a971c68db953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=B8=85=E7=BF=94?= <3371439772@qq.com> Date: Thu, 2 Mar 2023 12:40:16 +0800 Subject: [PATCH 3/4] =?UTF-8?q?3=E6=9C=882=E6=97=A5=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../3.2\344\275\234\344\270\232.md" | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 "52\347\250\213\345\270\205\347\277\224/3.2\344\275\234\344\270\232.md" diff --git "a/52\347\250\213\345\270\205\347\277\224/3.2\344\275\234\344\270\232.md" "b/52\347\250\213\345\270\205\347\277\224/3.2\344\275\234\344\270\232.md" new file mode 100644 index 0000000..4cfb59f --- /dev/null +++ "b/52\347\250\213\345\270\205\347\277\224/3.2\344\275\234\344\270\232.md" @@ -0,0 +1,130 @@ +| **create** **database** class2 charset utf8; | | | +| -------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| | [3](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_3) | use class2; | +| | [4](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_4) | | +| | [5](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_5) | **CREATE** **TABLE** `student` ( | +| | [6](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_6) | `Sno` varchar(20) **NOT** **NULL**, | +| | [7](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_7) | `Sname` varchar(20) **NOT** **NULL**, | +| | [8](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_8) | `Ssex` varchar(20) **NOT** **NULL**, | +| | [9](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_9) | `Sbirthday` datetime **DEFAULT** **NULL**, | +| | [10](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_10) | `Class` varchar(20) **DEFAULT** **NULL**, | +| | [11](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_11) | **PRIMARY** **KEY** (`Sno`), | +| | [12](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_12) | **KEY** `Sname` (`Sname`) | +| | [13](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_13) | ) ENGINE=InnoDB **DEFAULT** CHARSET=utf8; | +| | [14](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_14) | | +| | [15](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_15) | **CREATE** **TABLE** `course` ( | +| | [16](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_16) | `Cno` varchar(20) **NOT** **NULL**, | +| | [17](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_17) | `Cname` varchar(20) **NOT** **NULL**, | +| | [18](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_18) | `Tno` varchar(20) **NOT** **NULL**, | +| | [19](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_19) | **PRIMARY** **KEY** (`Cno`), | +| | [20](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_20) | **KEY** `Tn` (`Tno`), | +| | [21](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_21) | **KEY** `Cname` (`Cname`), | +| | [22](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_22) | **KEY** `Cno` (`Cno`,`Tno`), | +| | [23](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_23) | **CONSTRAINT** `Tn` **FOREIGN** **KEY** (`Tno`) **REFERENCES** `teacher` (`Tno`) | +| | [24](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_24) | ) ENGINE=InnoDB **DEFAULT** CHARSET=utf8; | +| | [25](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_25) | | +| | [26](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_26) | **CREATE** **TABLE** `score` ( | +| | [27](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_27) | `Sno` varchar(20) **NOT** **NULL**, | +| | [28](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_28) | `Cno` varchar(20) **NOT** **NULL**, | +| | [29](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_29) | `Degree` decimal(4,1) **DEFAULT** **NULL**, | +| | [30](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_30) | **KEY** `Sn` (`Sno`), | +| | [31](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_31) | **KEY** `Cn` (`Cno`), | +| | [32](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_32) | **CONSTRAINT** `Cn` **FOREIGN** **KEY** (`Cno`) **REFERENCES** `course` (`Cno`), | +| | [33](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_33) | **CONSTRAINT** `Sn` **FOREIGN** **KEY** (`Sno`) **REFERENCES** `student` (`Sno`) | +| | [34](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_34) | ) ENGINE=InnoDB **DEFAULT** CHARSET=utf8; | +| | [35](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_35) | | +| | [36](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_36) | **CREATE** **TABLE** `teacher` ( | +| | [37](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_37) | `Tno` varchar(20) **NOT** **NULL**, | +| | [38](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_38) | `Tname` varchar(20) **NOT** **NULL**, | +| | [39](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_39) | `Tsex` varchar(20) **NOT** **NULL**, | +| | [40](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_40) | `Tbirthday` datetime **DEFAULT** **NULL**, | +| | [41](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_41) | `Prof` varchar(20) **DEFAULT** **NULL**, | +| | [42](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_42) | `Depart` varchar(20) **NOT** **NULL**, | +| | [43](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_43) | **PRIMARY** **KEY** (`Tno`), | +| | [44](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_44) | **KEY** `Depart` (`Depart`) | +| | [45](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_45) | ) ENGINE=InnoDB **DEFAULT** CHARSET=utf8; | +| | [46](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_46) | | +| | [47](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_47) | **insert** **into** Student **values** | +| | [48](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_48) | (108,'曾华','男','1977-9-1',95033), | +| | [49](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_49) | (105,'匡明','男','1975-10-2',95031), | +| | [50](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_50) | (107,'王丽','女','1976-1-23',95033), | +| | [51](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_51) | (101,'李军','男','1976-2-20',95033), | +| | [52](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_52) | (109,'王芳','女','1975-2-10',95031), | +| | [53](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_53) | (103,'陆君','男','1974-6-3',95031); | +| | [54](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_54) | | +| | [55](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_55) | **insert** **into** course **values** | +| | [56](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_56) | (3-105,'计算机导论',825), | +| | [57](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_57) | (3-245,'操作系统',804), | +| | [58](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_58) | (6-166,'数字电路',856), | +| | [59](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_59) | (9-888,'高等数学',831); | +| | [60](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_60) | | +| | [61](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_61) | **insert** **into** score **values** | +| | [62](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_62) | (103,'3-245',86), | +| | [63](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_63) | (105,'3-245',75), | +| | [64](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_64) | (109,'3-245',68), | +| | [65](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_65) | (103,'3-105',92), | +| | [66](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_66) | (105,'3-105',88), | +| | [67](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_67) | (109,'3-105',76), | +| | [68](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_68) | (101,'3-105',64), | +| | [69](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_69) | (107,'3-105',91), | +| | [70](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_70) | (108,'6-180',78), | +| | [71](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_71) | (101,'6-180',85), | +| | [72](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_72) | (107,'6-166',79), | +| | [73](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_73) | (108,'6-166',81); | +| | [74](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_74) | | +| | [75](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_75) | **insert** **into** teacher **values** | +| | [76](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_76) | (804,'李诚','男','1958-12-2','副教授','计算机系'), | +| | [77](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_77) | (856,'张旭','男','1969-3-12','讲师','电子工程系'), | +| | [78](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_78) | (825,'王萍','女','1972-5-5','助教','计算机系'), | +| | [79](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_79) | (831,'刘冰','女','1958-12-2','助教','电子工程系'); | +| | [80](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_80) | | +| | [81](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_81) | #1.查询所有学生,都学了哪些课程,要显示学生信息和课程信息 | +| | [82](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_82) | **select** * **from** student,course,score **where** score.cno = course.Cno **and** student.sno=score.sno; | +| | [83](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_83) | #2.查询没有学生的教师的所有信息 | +| | [84](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_84) | **select** * **from** teacher **where** depart='电子工程系'; | +| | [85](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_85) | #① 查询Score表中的最高分的学生学号和课程号。 | +| | [86](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_86) | **select** sno,cno **from** score **where** degree='91'; | +| | [87](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_87) | #② 查询所有学生的Sname、Cno和Degree列。 | +| | [88](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_88) | **select** student.sname,course.cno,score.degree **from** student, course, score **where** score.cno = course.Cno **and** student.sno=score.sno ; | +| | [89](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_89) | #③ 查询所有学生的Sno、Cname和Degree列。 | +| | [90](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_90) | **select** student.Sno,course.cname,score.degree **from** student, course, score **where** score.cno = course.Cno **and** student.sno=score.sno ; | +| | [91](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_91) | #④ 查询所有学生的Sname、Cname和Degree列。 | +| | [92](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_92) | **select** student.sname,course.cname,score.degree **from** student, course, score **where** score.cno = course.Cno **and** student.sno=score.sno ; | +| | [93](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_93) | #⑤ 查询“95033”班学生的平均分。 | +| | [94](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_94) | **select** **avg**(degree) **from** score,student **where** student.sno=score.sno **and** student.**class**='95033'; | +| | [95](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_95) | #⑥ 查询选修“3-105”课程的成绩高于“109”号同学成绩的所有同学的记录。 | +| | [96](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_96) | **select** * **from** student,score **where** cno='3-105' **and** Degree>76 **and** student.sno=score.sno; | +| | [97](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_97) | **select** * **from** score; | +| | [98](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_98) | #⑦ 查询score中选学多门课程的同学中分数为非最高分成绩的记录。 | +| | [99](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_99) | | +| | [100](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_100) | #⑧ 查询成绩高于学号为“109”、课程号为“3-105”的成绩的所有记录。 | +| | [101](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_101) | **select** * **from** student,score **where** degree>76 **and** cno='3-105' **and** student.sno=score.sno; | +| | [102](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_102) | #⑨ 查询和学号为108的同学同年出生的所有学生的Sno、Sname和Sbirthday列。 | +| | [103](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_103) | **select** sno,sname,Sbirthday **from** student **where** Sbirthday='1977-9-1'; | +| | [104](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_104) | #⑩ 查询“张旭“教师任课的学生成绩。 | +| | [105](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_105) | **select** sname,cname,degree **from** student,score,teacher,course **where** tname='张旭' **and** student.sno=score.sno **and** score.cno = course.Cno **and** teacher.Tno=course.Tno; | +| | [106](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_106) | #⑪ 查询选修某课程的同学人数多于5人的教师姓名。 | +| | [107](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_107) | #**select** tname,**count**(cno) a **from** score,teacher, student,course **where** a>=5 ; | +| | [108](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_108) | #⑫ 查询出“计算机系“教师所教课程的成绩表。 | +| | [109](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_109) | **select** degree,depart **from** score **LEFT** **JOIN** teacher **on** depart='计算机系' ; | +| | [110](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_110) | #⑬ 查询“计算机系”与“电子工程系“不同职称的教师的Tname和Prof。 | +| | [111](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_111) | | +| | [112](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_112) | #⑭ 查询选修编号为“3-105“课程且成绩至少高于选修编号为“3-245”的同学的Cno、Sno和Degree,并按Degree从高到低次序排序。 | +| | [113](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_113) | | +| | [114](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_114) | #⑮ 查询选修编号为“3-105”且成绩高于选修编号为“3-245”课程的同学的Cno、Sno和Degree. | +| | [115](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_115) | | +| | [116](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_116) | #⑯ 查询成绩比该课程平均成绩低的同学的成绩表。 | +| | [117](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_117) | | +| | [118](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_118) | #⑰ 查询所有任课教师的Tname和Depart. | +| | [119](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_119) | | +| | [120](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_120) | #⑱ 查询所有未讲课的教师的Tname和Depart. | +| | [121](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_121) | | +| | [122](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_122) | #⑲ 查询“男”教师及其所上的课程。 | +| | [123](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_123) | | +| | [124](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_124) | #⑳ 查询最高分同学的Sno、Cno和Degree列。 | +| | [125](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_125) | | +| | [126](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_126) | #21 查询和“李军”同性别的所有同学的Sname. | +| | [127](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_127) | | +| | [128](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_128) | #22 查询和“李军”同性别并同班的同学Sname. | +| | [129](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_129) | | +| | [130](https://gitee.com/lmjli-mingjian/mysql-base/commit/8921e53e5325aa87ef9f74ba882ddc0715311a45#10248c5ca78552391319fe82d4194ad3e763d825_0_130) | #23 查询所有选修“计算机导论”课程的“男”同学的成绩表。 | \ No newline at end of file -- Gitee From 6a56e9f7aa06680e875bc0514fe3528edb916ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=B8=85=E7=BF=94?= <3371439772@qq.com> Date: Thu, 9 Mar 2023 12:49:39 +0800 Subject: [PATCH 4/4] =?UTF-8?q?3.8=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...45\350\257\242\344\275\234\344\270\232.md" | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 "52\347\250\213\345\270\205\347\277\224/\345\255\220\346\237\245\350\257\242\344\275\234\344\270\232.md" diff --git "a/52\347\250\213\345\270\205\347\277\224/\345\255\220\346\237\245\350\257\242\344\275\234\344\270\232.md" "b/52\347\250\213\345\270\205\347\277\224/\345\255\220\346\237\245\350\257\242\344\275\234\344\270\232.md" new file mode 100644 index 0000000..c1fb722 --- /dev/null +++ "b/52\347\250\213\345\270\205\347\277\224/\345\255\220\346\237\245\350\257\242\344\275\234\344\270\232.md" @@ -0,0 +1,115 @@ +| \| ### 笔记 \| \| \| | | | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| | [2](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_2) | \| -------- \| ------------------------------------------------------------ \| ------------------------------------------------------------ \| | +| | [3](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_3) | \| \| [2](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_2) \| \| | +| | [4](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_4) | \| \| [3](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_3) \| ##### 子查询 \| | +| | [5](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_5) | \| \| [4](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_4) \| \| | +| | [6](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_6) | \| \| [5](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_5) \| - 嵌套在其他SQL语句中的查询语句。 \| | +| | [7](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_7) | \| \| [6](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_6) \| - 子查询通常先运行,所以要用()包裹起来。 \| | +| | [8](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_8) | \| \| [7](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_7) \| - 子查询的运行结果,可以作为其他语句的条件,数据源等。 \| | +| | [9](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_9) | \| \| [8](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_8) \| \| | +| | [10](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_10) | \| \| [9](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_9) \| ##### 子查询分三种形式 \| | +| | [11](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_11) | \| \| [10](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_10) \| \| | +| | [12](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_12) | \| \| [11](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_11) \| select 1 from 2 where 3 \| | +| | [13](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_13) | \| \| [12](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_12) \| \| | +| | [14](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_14) | \| \| [13](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_13) \| 1.放在select后面 \| | +| | [15](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_15) | \| \| [14](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_14) \| \| | +| | [16](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_16) | \| \| [15](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_15) \| 2.放在where/having后面 \| | +| | [17](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_17) | \| \| [16](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_16) \| \| | +| | [18](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_18) | \| \| [17](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_17) \| 3.放在from后面,子查询当做一个临时的表使用,必须要给别名。 \| | +| | [19](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_19) | \| \| [18](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_18) \| \| | +| | [20](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_20) | \| \| [19](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_19) \| ##### where或having后的子查询,其子查询的结果有三种形式 \| | +| | [21](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_21) | \| \| [20](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_20) \| \| | +| | [22](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_22) | \| \| [21](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_21) \| 1.单列单个值,可以直接使用比较运算符 \| | +| | [23](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_23) | \| \| [22](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_22) \| \| | +| | [24](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_24) | \| \| [23](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_23) \| 2.单列多个值,可以使用 in ,not in 进行比较 \| | +| | [25](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_25) | \| \| [24](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_24) \| \| | +| | [26](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_26) | \| \| [25](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_25) \| 3.单列多个值,可以使用比较运算符,搭配any,all,等关键字与查询结果进行比较 \| | +| | [27](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_27) | \| \| [26](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_26) \| \| | +| | [28](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_28) | \| \| [27](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_27) \| ##### 子查询结果是单列,可以放在select参与运算,或者是作为字段,也可以放在where / having后当条件。 \| | +| | [29](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_29) | \| \| [28](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_28) \| \| | +| | [30](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_30) | \| \| [29](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_29) \| ##### 子查询结果是多列,多个值,只能放在from后面当临时表使用,并且必须取别名。 \| | +| | [31](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_31) | \| \| [30](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_30) \| \| | +| | [32](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_32) | \| \| [31](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_31) \| ### 作业 \| | +| | [33](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_33) | \| \| [32](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_32) \| \| | +| | [34](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_34) | \| \| [33](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_33) \| ~~~ mysql \| | +| | [35](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_35) | \| \| [34](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_34) \| create database text1; \| | +| | [36](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_36) | \| \| [35](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_35) \| use text1; \| | +| | [37](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_37) | \| \| [36](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_36) \| alter database text1 charset utf8; \| | +| | [38](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_38) | \| \| [37](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_37) \| alter table stuinfo charset utf8; \| | +| | [39](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_39) | \| \| [38](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_38) \| alter table stuExam charset utf8; \| | +| | [40](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_40) | \| \| [39](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_39) \| alter table stuMarks charset utf8; \| | +| | [41](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_41) | \| \| [40](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_40) \| \| | +| | [42](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_42) | \| \| [41](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_41) \| create table stuinfo( \| | +| | [43](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_43) | \| \| [42](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_42) \| stuNO varchar(10) primary key, \| | +| | [44](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_44) | \| \| [43](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_43) \| stuName varchar(10), \| | +| | [45](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_45) | \| \| [44](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_44) \| stuSex varchar(5), \| | +| | [46](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_46) | \| \| [45](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_45) \| stuAge double, \| | +| | [47](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_47) | \| \| [46](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_46) \| stuAddress varchar(20), \| | +| | [48](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_48) | \| \| [47](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_47) \| stuSeat int auto_increment unique \| | +| | [49](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_49) | \| \| [48](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_48) \| ); \| | +| | [50](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_50) | \| \| [49](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_49) \| create table stuExam( \| | +| | [51](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_51) | \| \| [50](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_50) \| examNo int primary key, \| | +| | [52](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_52) | \| \| [51](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_51) \| stuNO varchar(10), \| | +| | [53](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_53) | \| \| [52](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_52) \| writtenExam varchar(10), \| | +| | [54](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_54) | \| \| [53](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_53) \| labExam double, \| | +| | [55](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_55) | \| \| [54](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_54) \| foreign key(stuNo) references stuinfo(stuNo) \| | +| | [56](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_56) | \| \| [55](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_55) \| ); \| | +| | [57](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_57) | \| \| [56](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_56) \| create table stuMarks( \| | +| | [58](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_58) | \| \| [57](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_57) \| examNO int, \| | +| | [59](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_59) | \| \| [58](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_58) \| stuID varchar(10), \| | +| | [60](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_60) | \| \| [59](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_59) \| score double, \| | +| | [61](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_61) | \| \| [60](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_60) \| foreign key(examNO) references stuExam(examNO) \| | +| | [62](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_62) | \| \| [61](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_61) \| ); \| | +| | [63](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_63) | \| \| [62](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_62) \| insert into stuinfo values \| | +| | [64](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_64) | \| \| [63](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_63) \| ('s2501','张秋利','男',20,'美国硅谷',1), \| | +| | [65](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_65) | \| \| [64](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_64) \| ('s2502','李斯文','女',18,'湖北武汉',2), \| | +| | [66](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_66) | \| \| [65](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_65) \| ('s2503','马文才','男',18,'湖南长沙',3), \| | +| | [67](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_67) | \| \| [66](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_66) \| ('s2504','欧阳俊雄','女',21,'湖北武汉',4), \| | +| | [68](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_68) | \| \| [67](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_67) \| ('s2505','梅超风','男',16,'湖北武汉',5), \| | +| | [69](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_69) | \| \| [68](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_68) \| ('s2506','陈旋风','男',19,'美国硅谷',6); \| | +| | [70](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_70) | \| \| [69](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_69) \| insert into stuExam values \| | +| | [71](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_71) | \| \| [70](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_70) \| (1,'s2501','50',70), \| | +| | [72](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_72) | \| \| [71](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_71) \| (2,'s2502','60',65), \| | +| | [73](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_73) | \| \| [72](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_72) \| (3,'s2503','86',70), \| | +| | [74](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_74) | \| \| [73](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_73) \| (4,'s2504','40',80), \| | +| | [75](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_75) | \| \| [74](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_74) \| (5,'s2505','70',85), \| | +| | [76](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_76) | \| \| [75](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_75) \| (6,'s2506','85',90); \| | +| | [77](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_77) | \| \| [76](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_76) \| insert into stuMarks values \| | +| | [78](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_78) | \| \| [77](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_77) \| (1,'s2501',88), \| | +| | [79](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_79) | \| \| [78](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_78) \| (2,'s2501',92), \| | +| | [80](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_80) | \| \| [79](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_79) \| (3,'s2501',53), \| | +| | [81](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_81) | \| \| [80](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_80) \| (4,'s2502',60), \| | +| | [82](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_82) | \| \| [81](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_81) \| (5,'s2502',99), \| | +| | [83](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_83) | \| \| [82](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_82) \| (6,'s2503',82); \| | +| | [84](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_84) | \| \| [83](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_83) \| -- 1.查询出年龄比班上平均年龄大的学生的信息 \| | +| | [85](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_85) | \| \| [84](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_84) \| select * from stuinfo where stuAge>(select round(avg(stuAge),2) from stuinfo); \| | +| | [86](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_86) | \| \| [85](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_85) \| -- 2.查询出每个学生的学号,姓名,性别和选修课程的最高分(stuMarks) \| | +| | [87](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_87) | \| \| [86](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_86) \| select t.stuNO,t.stuName,t.stuAge,max(score) from stumarks s left join stuinfo t on s.stuID=t.stuNO group by s.stuID; \| | +| | [88](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_88) | \| \| [87](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_87) \| -- 3.查询出每个学生的学号,姓名,性别和考试平均分(stuExam) \| | +| | [89](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_89) | \| \| [88](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_88) \| select avg(writtenExam+labExam) from stuexam right join stuinfo on stuexam.stuNO=stuinfo.stuNO GROUP BY stuexam.stuNO; \| | +| | [90](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_90) | \| \| [89](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_89) \| -- 4.查询性别是男并且年龄大于等于20的学生的信息(用两种方法实现:普通查询和子查询) \| | +| | [91](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_91) | \| \| [90](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_90) \| -- 普通查询 \| | +| | [92](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_92) | \| \| [91](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_91) \| select * from stuinfo where stusex='男' and stuage>=20; \| | +| | [93](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_93) | \| \| [92](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_92) \| -- 子查询 \| | +| | [94](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_94) | \| \| [93](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_93) \| select * from stuinfo where stuage=(select stuage from stuinfo where stusex='男' and stuage>=20); \| | +| | [95](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_95) | \| \| [94](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_94) \| -- 5.查询出年龄比所有男生年龄都大的女生的信息 \| | +| | [96](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_96) | \| \| [95](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_95) \| select stuSex,max(stuAge) from stuinfo where stuSex='女' and stuAge> all(select stuAge from stuinfo where stuSex ='男'); \| | +| | [97](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_97) | \| \| [96](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_96) \| -- 6.查询出所有选修课程都及格的学生的信息 (stuMarks) \| | +| | [98](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_98) | \| \| [97](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_97) \| select t.stuNO,t.stuName,t.stuAge,max(score) from stumarks s left join stuinfo t on s.stuID=t.stuNO group by s.stuID; \| | +| | [99](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_99) | \| \| [98](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_98) \| -- 7.查询出参加考试的学生的信息(用表连接,in二种方法做)(stuMarks) \| | +| | [100](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_100) | \| \| [99](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_99) \| select * from stuinfo a left join stumarks c on a.stuNO=c.stuID where stuID is NULL; \| | +| | [101](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_101) | \| \| [100](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_100) \| -- 8.查询出没有参加考试的学生的信息(用表连接,in二种方法做)(stuMarks) \| | +| | [102](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_102) | \| \| [101](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_101) \| select * from stuinfo a left join stumarks c on a.stuNO=c.stuID where a.stuNO not in (select stuID from stumarks group by stuID); \| | +| | [103](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_103) | \| \| [102](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_102) \| -- 9.将有一门成绩成绩大于90分的学生的基本信息查询出来(stuMarks) \| | +| | [104](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_104) | \| \| [103](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_103) \| select * from stuinfo left join stumarks on stuinfo.stuNO=stumarks.stuID where score>90; \| | +| | [105](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_105) | \| \| [104](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_104) \| -- 10.查询出平均成绩在80分以上的学生的基本信息(stuMarks) \| | +| | [106](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_106) | \| \| [105](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_105) \| select * from stuinfo left join stumarks on stuinfo.stuNO=stumarks.stuID where score>(select avg(score) from stumarks) \| | +| | [107](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_107) | \| \| [106](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_106) \| -- 11.查询出某同学所有考试成绩比“张秋利”同学所有分数都高的学生基本信息(stuMarks) \| | +| | [108](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_108) | \| \| [107](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_107) \| select * from stuinfo left join stumarks on stuinfo.stuNO=stumarks.stuID where stumarks.score > any(select score from stumarks where stumarks.stuID='s2501' ) and stuinfo.stuName != '张秋利' \| | +| | [109](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_109) | \| \| [108](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_108) \| -- 12.查询出某同学所有考试成绩只需要比“张秋利”同学某个分数高的学生基本信息(stuMarks) \| | +| | [110](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_110) | \| \| [109](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_109) \| select * from stuinfo left join stumarks on stuinfo.stuNO=stumarks.stuID where stumarks.score > any(select score from stumarks where stumarks.stuID='s2501' ) and stuinfo.stuName != '张秋利' \| | +| | [111](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_111) | \| \| [110](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_110) \| -- 13.查询班上比所有男生年龄都要大的女生的信息 \| | +| | [112](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_112) | \| \| [111](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_111) \| select stuSex,max(stuAge) from stuinfo where stuSex='女' and stuAge> all(select stuAge from stuinfo where stuSex ='男'); \| | +| | [113](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_113) | \| \| [112](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_112) \| -- 14.查询出只要比某个男生年龄大的女生的信息 \| | +| | [114](https://gitee.com/caijiale777/mysql-base/commit/63ab3395e5de805323488e9531e042c13582a1bb#0577cfdc9718621856d9cf258a20bdd6f55997f6_0_114) | \| \| [113](https://gitee.com/class-22-class-02/mysql-base/commit/c3abcf70c458af1f8b8b6e71e08d7de13768110c#96fe666e524fb6acd3b9389512c56be5eff26a71_0_113) \| select * from stuinfo where stusex = '女' and stuage > (select min(stuage) from stuinfo where stusex = '男'); | \ No newline at end of file -- Gitee