insert into student values('S01','张三','男',null,null,null,null)
select *from student;
insert into student(studentid,sex,studentname)
values('S02','男','zs');
insert into student(studentid,sex,studentname)
values('S03','男','zs'),('S04','男','zs'),('S05','男','zs');
create table student_copy like student;
select *from student_copy;
update student
set studentname='李四',sex='女'
where studentname= '张三';
select *from student;
delete from student;
delete from student
where studentid='St0109010001';
update student
set HomeAddr=null
where studentid= 'St0109010004';
select studentid,studentname from student;
select CourseName,credit from course;
select studentid,studentname,2010-year(birth1) as '年龄' from student;
select studentid,courseid,grade,
case when grade<60 then '差'
when grade>=60 and grade<=80 then '良好'
else '优秀' end '成绩等级'
from grade;
select classid,departmentid,
case when departmentid='Dp01' then '计算机系'
else '英语系' end '系别'
from class;
select distinct studentid from grade;
select distinct courseid from grade;
select distinct grade from grade;
select sum(grade) as '总成绩' from grade;
select AVG(grade) as '平均成绩' from grade;
select studentid,(sum(grade)/6) as grade_sum from grade group by studentid;
select studentid,avg(grade_sum) as grade_sum from grade group by studentid;
select count(studentid) as '学生人数' from student;
select min(birth1) as '年龄最大' from student;
select StudentName from student where birth1 in (select min(birth1) from student);
select StudentName,HomeAddr from student;
转载请注明原文地址:https://blackberry.8miu.com/read-35259.html