分析

关键词:where,inner join

创建联结:

  • 方法1:使用where。from 表1,表2 where 表1.列名x=表2.列名x
  • 方法2:使用inner join。from 表1 inner join 表2 on 表1.列名x=表2.列名x

代码

/*
-- 另一种方法
select cust_name,order_num
from Customers as cus
inner join Orders as ord on cus.cust_id=ord.cust_id
order by cust_name,order_num
*/

select cust_name,order_num
from Customers,Orders
where Customers.cust_id=Orders.cust_id
order by cust_name,order_num