Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 01 ORACLE
- -- WHERE:
- Select c.companyname, o.orderdate, e.lastname
- From orders o, customers c, employees e
- Where o.customerid=c.customerid and
- o.employeeid=e.employeeid;
- -- FROM:
- Select companyname, orderdate, lastname
- From orders o
- Join customers c
- On o.customerid=c.customerid
- Join employees e
- On o.employeeid=e.employeeid;
- -- 02 ORACLE
- -- WHERE:
- Select o.orderdate, q.quantity, p.productname
- From Orders o, Orderdetails q, products p
- Where o.orderid=q.orderid and q.productid=p.productid;
- -- FROM:
- Select orderdate, quantity, productname
- From orders o
- Join orderdetails q
- On o.orderid=q.orderid
- Join products p
- On q.productid=p.productid;
- -- 03 ORACLE
- -- WHERE:
- Select p.productname, c.categoryname, sum(o.quantity) as "Total Quantity"
- From Products p, Categories c, Orderdetails O
- Where p.categoryid = c.categoryid and p.productid = o.productid
- Group By Productname, Categoryname
- Order By sum(quantity) desc;
- -- FROM:
- Select Productname, categoryname, sum(quantity) as "Total Quantity"
- From Products p
- Join Categories c
- On p.categoryid = c.categoryid
- Join Orderdetails o
- On p.productid = o.productid
- Group By Productname, categoryname
- Order By sum(quantity) desc;
- -- 04 ORACLE
- -- WHERE:
- Select e.Lastname, t.TerritoryDescription, r.RegionDescription
- From Employees e, Territories t, Region r, Employeeterritories i
- Where t.regionid = r.regionid and i.territoryid = t.territoryid and e.employeeid = i.employeeid
- Order By Lastname;
- -- FROM:
- Select Lastname, TerritoryDescription, RegionDescription
- From Territories t
- Join Region r
- On t.regionid = r.regionid
- Join Employeeterritories i
- On i.territoryid = t.territoryid
- Join Employees e
- On e.employeeid = i.employeeid
- Order By Lastname;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement