多表联接查询和创建新表

多表联接查询:内联接(inner join)、外联接((left、right、full)outer join)、自联接(self join)和交叉联接(cross join)

在查询上创建新表:select into语句首先创建一个新表,然后用查询的结果填充新表。

表别名

select coursename from course where courseid in(select distinct courseid from grade where grade>10)

select studname from student where sudbirthday > any (select studbirthday from student where class = '信息系') and class<>'信息系'

select studname from student where exists (select * from grade where studid = student.studid and courseid = '01')

select stud1.* from student as stud1 join student as stud2 on stud2.studname = 'mm' and stud1.studsex = stud2.studsex

select * into girls from student where studsex='m'

你可能感兴趣的:(多表联接查询和创建新表)