Bunich

Lab1 - Basi

Mar 27th, 2018
80
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT * FROM DELIVERERS;
  2. SELECT DISTINCT companyid FROM companydel;
  3. SELECT delivererid,name FROM deliverers WHERE name LIKE 'B%';
  4. SELECT name,sex,DELIVERERID FROM deliverers WHERE phoneno<>8467 OR phoneno IS NULL;
  5. SELECT DISTINCT name,town FROM DELIVERERS D, PENALTIES P WHERE P.DELIVERERID=D.DELIVERERID;
  6. SELECT DISTINCT D.name,D.initials FROM DELIVERERS D,PENALTIES P,COMPANies C WHERE D.DELIVERERID=P.DELIVERERID AND C.DELIVERERID=D.DELIVERERID AND P.DATA>to_date('31/12/1980','DD/MM/YYYY') ORDER BY D.NAME;
  7. SELECT DISTINCT C.COMPANYID,C.DELIVERERID FROM companydel C,Deliverers D WHERE C.DELIVERERID=D.delivererid AND D.town='Stratford' AND C.NUMCOLLECTIONS>=2 AND C.NUMDELIVERIES>=1;
  8. SELECT D.DELIVERERID FROM COMPANYDEL CD, COMPANIES C, DELIVERERS D WHERE D.YEAR_OF_BIRTH>1962 AND C.MANDATE='first' AND CD.DELIVERERID=D.DELIVERERID AND c.COMPANYID=CD.COMPANYID;
  9. SELECT DISTINCT D.name FROM companydel C1,companydel C2, deliverers D WHERE C1.DELIVERERID=C2.DELIVERERID AND C1.COMPANYID<>C2.COMPANYID AND C1.DELIVERERID=D.DELIVERERID AND (D.town='Inglewood' OR D.town='Stratford');
  10. SELECT D.DELIVERERID,SUM(DISTINCT P1.AMOUNT)
  11. FROM PENALTIES P1, PENALTIES P2,DELIVERERS D
  12. WHERE P1.PAYMENTID<>P2.PAYMENTID AND P1.DELIVERERID=P2.DELIVERERID AND P1.DELIVERERID=D.DELIVERERID AND D.town='Inglewood'
  13. GROUP BY D.DELIVERERID;
RAW Paste Data