0
我的SQL作业有很多问题。特别是一旦我必须处理两个以上的表来获得所需的解决方案,我就会陷入困境。SQL与多个表的连接表
一个例子是列出由阿蒙顿普通商店放置的每个订单的订单号和订单日期,其中包含消防车的订单行。
我试着用下面的代码来完成这个。
select order_num, order_date
from orders
where exists (select *
from customer, order_line, item
where orders.customer_num = customer.customer_num
and customer_name = 'Almondton Genreal Store'
or orders.order_num = order_line.order_num
and order_line.item_num = item.item_num
and description = 'fire truck');
我需要知道一般如何处理一次使用两个以上的表。
哪个RDBMS用于此目的?请添加一个标签来指定您是使用'mysql','postgresql','sql-server','oracle'还是'db2' - 或者其他的东西。 –
[坏习惯踢:使用旧式联接](http://sqlblog.com/blogs/aaron_bertrand/archive/2009/10/08/bad-habits-to-kick-using-old-style-joins。 aspx) - 在ANSI - ** 92 ** SQL标准(**超过20年前**)中,旧式*逗号分隔的表*样式列表被替换为* proper * ANSI'JOIN'语法它的使用是不鼓励的 –