Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Q2: get details of the current Deans of Faculty
  2. create or replace view Q2(name, faculty, phone, starting)
  3. as
  4. select names.name, faculties.longname, phonenums.phone, deans.starting from
  5.         (select id, longname from orgunits
  6.         group by id
  7.         having utype = 1) as faculties
  8.  
  9.         inner join
  10.         (select staff, orgunit, starting from affiliations
  11.         where role = 1286) as deans
  12.         on faculties.id = deans.orgunit
  13.  
  14.         inner join
  15.         (select id, phone from staff) as phonenums
  16.         on phonenums.id = deans.staff
  17.  
  18.         inner join
  19.         (select unswid, name from people) as names
  20.         on names.unswid = deans.staff
  21. --... SQL statements, possibly using other views/functions defined by you ...
  22. ;
  23. /*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement