第3次作业-SQL语句的基本使用
alter table curriculum
-> drop 课程名称;
mysql> alter table grade
-> modify 分数 decimal(5,2);
Query OK, 15 rows affected (0.03 sec)
Records: 15 Duplicates: 0 Warnings: 0
mysql> desc grade;
alter table student_info
-> add 备注 varchar(50);
mysql> create database studb;
Query OK, 1 row affected (0.00 sec)
mysql> use studb;
Database changed
mysql> create table stu
-> as select * from studentsdb,student_info;
1146 - Table 'studb.studentsdb' doesn't exist
mysql> create table stu
-> as select * from studentsdb.student_info;
mysql> update stu
-> set 家庭住址 ='滨江市新建路i96号' where 学号 ='0002';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from stu;
alter table stud
-> drop 备注;
mysql> use studentsdb;
Database changed
mysql> select 学号,姓名,家庭住址 from student_info;
mysql> select 姓名,家庭住址 from student_info where 学号='0002';
mysql> select 姓名,家庭住址 from student_info where 学号>'0005' and 性别='女';
mysql> select 学号,课程编号,分数 from grade where 分数 between 70 and 80;
mysql> select avg(分数) as 平均成绩 from grade where 学号='0002';
mysql> SELECT COUNT(*) 选课人数,COUNT(分数) 有成绩人数 FROM grade WHERE 课程编号 = '0003';
mysql> select 姓名,家庭住址 from student_info ORDER BY 姓名 DESC;
mysql> select 学号,姓名 from student_info where 姓名 like '张%';