數據庫多表查詢sql語句語法有:
外左連接:一般使用 left join 或 left outer join;
例句:select * from student left join score on student.Num=score.Stu_id;
外右連接:一般使用right join 或 right outer join;
例句:select * from student right join score on student.Num=score.Stu_id;
完全外連接:一般使用full join 或 full outer join;
例句:select * from student full join score on student.Num=score.Stu_id;
內連接:一般使用join 或 inner join;
例句:select * from student inner join score on student.Num=score.Stu_id;
交叉連接:一般使用cross join,沒有where指定查詢條件的子句的交叉聯接將產生兩表的笛卡爾積。
例句:select * from student cross join score;
回答所涉及的環境:聯想天逸510S、Windows 10。
數據庫多表查詢sql語句語法有:
外左連接:一般使用 left join 或 left outer join;
例句:select * from student left join score on student.Num=score.Stu_id;
外右連接:一般使用right join 或 right outer join;
例句:select * from student right join score on student.Num=score.Stu_id;
完全外連接:一般使用full join 或 full outer join;
例句:select * from student full join score on student.Num=score.Stu_id;
內連接:一般使用join 或 inner join;
例句:select * from student inner join score on student.Num=score.Stu_id;
交叉連接:一般使用cross join,沒有where指定查詢條件的子句的交叉聯接將產生兩表的笛卡爾積。
例句:select * from student cross join score;
回答所涉及的環境:聯想天逸510S、Windows 10。