1

我又遇到了一个我有问题的作业,是的,我一直在研究和阅读,所以这不是我第一次寻找答案。

任务是从多个表中获取输出,这意味着需要“连接”,因为信息分散在不同的表中。

我创建了如下所示的代码:

SELECT * FROM
order_, orderspec
WHERE order_.orderno = orderspec.orderno;

SELECT * FROM
order_, customer
WHERE order_.custno = customer.custno;

SELECT * FROM
order_, employee
WHERE order_.empno = employee.empno;

SELECT * FROM
orderspec, stock
WHERE orderspec.stockno = stock.stockno;

是否可以在一个查询/命令中完成所有这些操作?

4

1 回答 1

0

你可以这样尝试:-

SELECT * FROM
order_, orderspec, customer, employee, stock
WHERE order_.orderno = orderspec.orderno
and order_.custno = customer.custno
and order_.empno = employee.empno
and orderspec.stockno = stock.stockno;
于 2013-10-17T21:02:11.950 回答