1、等值与非等值连接查询

select Student.*,SC.*

from Student,SC

where Student.Sno=SC.Sno;

2、外连接

select Student.sno,sname,ssex,sage,sdept,cno,grade

from Student LEFT JOIN SC ON (Student.sno = SC.sno);

3、自身连接

select FIRST.cno,SECOND.cpno

from Course FIRST,Course SECOND

where FIRST.Cpno = SECOND.Cno;

4、复合条件连接

select Student.Sno,Sname,Grade

from Student,SC

where Student.Sno = SC.Sno AND

SC.Cno =’1′ AND SC.Grade >80;

select Student.Sno,Sname,Cname,Grade

from Student,SC,Course

where Student.Sno = SC.Sno AND SC.Cno = Course.Cno;

Tags: , ,

Related posts

Tags: ,,.
Home

No Comments Now!

Be the first to comment on this entry.

Leave a comment

Name(required)
Mail (required),(will not be published)
Website(recommended)

Fields in bold are required. Email addresses are never published or distributed.

Some HTML code is allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
URLs must be fully qualified (eg: http://hanghang.name),and all tags must be properly closed.

Line breaks and paragraphs are automatically converted.

Please keep comments relevant. Off-topic, offensive or inappropriate comments may be edited or removed.