SQL-关联表查询(连表查询)

0、例如:select * from T1,T2     where T1.a=T2.a

1、连表查询 <=> join(inner join)内连接查询

数据源: 
Persion表: 

 

 Orders表: 

 

 

//使用连表查询
SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo
FROM Persons,Orders
WHERE Persons.Id_P = Orders.Id_P

//使用join查询 SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo FROM Persons INNER JOIN Orders ON Persons.Id_P = Orders.Id_P ORDER BY Persons.LastName

结果: 

 

posted @ 2020-03-31 16:45  马踏飞燕Beautiful  阅读(2804)  评论(0编辑  收藏  举报