1.查询已订购了商品的客户的公司名称、订商品编号和订购数量。
方法1:
SELECT customer.customerid ,customer.companyname, sell_order.productid, sell_order.sellordernumber
FROM customer INNER JOIN sell_order
ON customer. customerid= sell_order. customerid;
方法2:
SELECT customer.customerid ,customer.companyname, sell_order.productid, sell_order.sellordernumber
FROM customer,sell_order
WHERE customer. customerid= sell_order. customerid;
2、查询客户“国皓科技有限公司”订购的商品编号和数量信息。
SELECT customer.companyname, sell_order.productid,sell_order.sellordernumber
FROM customer INNER JOIN sell_order
ON customer. customerid= sell_order. customerid
WHERE customer.companyname='国皓科技有限公司';