| 类型名称 |
说明 |
| int(integer) |
整数类型 |
| double |
小数类型 |
| decimal(m,d) |
指定整数位与小数位长度的小数类型 |
| date |
日期类型,格式为yyyy-MM-dd,包含年月日,不包含时分秒 |
| datetime |
日期类型,格式为yyyy-MM-dd HH:mm:ss,包含年月日时分秒 |
| timestamp |
日期类型,时间戳 |
| varchar(M) |
文本类型,M为0~65535之间的整数 |
a、写一个SQL语句,查询选修了计算机原理的学生学号和姓名
select 学号,姓名 from Student where 学号 in(select 学号 from Sc where 课程编号 in(Select 课程编号 from Course where 课程名称 = ‘计算机原理’))
b、写一个SQL语句,查询“周星驰”同学选修了的课程名字
select 课程名称 from Course where 编号 in (select Sc.课程编号 from Student,Sc where Student.姓名=’周星驰’ and Student.学号 = Sc.学号)
下一篇
MySQL 存储过程