这个作业属于哪个课程 https://edu.cnblogs.com/campus/uzz/cs3
这个作业要求在哪里 https://edu.cnblogs.com/campus/uzz/cs3/homework/13057
这个作业的目标 第3次作业-SQL语句的基本使用2(修改表-基本查询)

1

mysql> alter table curriculum drop 课程名称;
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0

2

mysql> alter table grade modify 分数 decimal(5,2);
Query OK, 15 rows affected (0.02 sec)
Records: 15  Duplicates: 0  Warnings: 0

3

mysql> alter table student_info add 备注 varchar(50);
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0

4

mysql> create database studb;
Query OK, 1 row affected (0.00 sec)

mysql> create table studb.stu as select * from studentsdb.student_info;
Query OK, 8 rows affected (0.01 sec)
Records: 8  Duplicates: 0  Warnings: 0

5

mysql> delete from stu where 学号='0004';
Query OK, 1 row affected (0.00 sec)

6

mysql> update stu set 家族住址='滨江市新建路96号' where 学号='0002';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

7

mysql> alter table stu drop 备注;
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0

8

mysql> select 学号,姓名,出生日期 from student_info;
+------+--------+------------+
| 学号 | 姓名   | 出生日期    |
+------+--------+------------+
| 0001 | 张青平 | 2000-10-01 |
| 0002 | 刘东阳 | 1998-12-09 |
| 0003 | 马晓夏 | 1995-05-12 |
| 0004 | 钱忠理 | 1994-09-23 |
| 0005 | 孙海洋 | 1995-04-03 |
| 0006 | 郭小斌 | 1997-11-10 |
| 0007 | 肖月玲 | 1996-12-07 |
| 0008 | 张玲珑 | 1997-12-24 |
+------+--------+------------+
8 rows in set (0.06 sec)
mysql> select 姓名,家族住址 from student_info where 学号='0002';
+--------+------------------+
| 姓名   | 家族住址          |
+--------+------------------+
| 刘东阳 | 东阳市八一北路33号 |
+--------+------------------+
1 row in set (0.07 sec)
mysql> select 姓名,出生日期 from student_info where 性别='女' and 出生日期>'1995-12-31';
+--------+------------+
| 姓名   | 出生日期    |
+--------+------------+
| 肖月玲 | 1996-12-07 |
| 张玲珑 | 1997-12-24 |
+--------+------------+
2 rows in set (0.10 sec)

9

mysql> select 学号,课程编号,分数 from grade where 分数 between '70' and '80';
+------+---------+-------+
| 学号 | 课程编号 | 分数  |
+------+---------+-------+
| 0001 | 0001    | 80.00 |
| 0001 | 0005    | 77.00 |
| 0002 | 0001    | 73.00 |
| 0002 | 0003    | 80.00 |
| 0002 | 0004    | 79.00 |
| 0002 | 0005    | 73.00 |
| 0003 | 0005    | 75.00 |
+------+---------+-------+
7 rows in set (0.07 sec)
mysql> select avg(分数) from grade where 课程编号='0002';
+-----------+
| avg(分数) |
+-----------+
| 83.666667 |
+-----------+
1 row in set (0.06 sec)
mysql> select 姓名,出生日期 from student_info order by 出生日期 desc;
+--------+------------+
| 姓名   | 出生日期    |
+--------+------------+
| 张青平 | 2000-10-01 |
| 刘东阳 | 1998-12-09 |
| 张玲珑 | 1997-12-24 |
| 郭小斌 | 1997-11-10 |
| 肖月玲 | 1996-12-07 |
| 马晓夏 | 1995-05-12 |
| 孙海洋 | 1995-04-03 |
| 钱忠理 | 1994-09-23 |
+--------+------------+
8 rows in set (0.05 sec)
mysql> select count(*) 选课人数,count(分数) 有成绩人数 from grade  
    where 课程编号 = '0003';  
+---------+-----------+
| 选课人数 | 有成绩人数 |
+---------+-----------+
|       3 |         3 |
+---------+-----------+
1 row in set (0.07 sec)
mysql> select 学号,姓名 from student_info where 姓名 like '张%';
+------+--------+
| 学号 | 姓名   |
+------+--------+
| 0001 | 张青平 |
| 0008 | 张玲珑 |
+------+--------+
2 rows in set (0.09 sec)