/* let's express relational operations in SQL */ -- get some example tables to play with start set-up-ex-tbls.sql /* pure selection! in SQL select * from desired_table where desired_bool_expr; */ -- selection of empls whose salary is more than 1500 select * from empl where salary > 1500; /* pure projection! select distinct attrib1, attrib2, ... from desired_tbl; */ -- projection of dept_num and job_title select distinct dept_num, job_title from empl; /* pure Cartesian product! select * from tbl1, tb2; */ -- Cartesian product of empl and dept (ugly!) select * from empl, dept; /* ONE form of pure equi-join! select * from tbl1, tbl2 where tbl1.attrib = tbl2.attrib; */ select * from empl, dept where empl.dept_num = dept.dept_num; /* natural join is just... tedious! select <all attribs of tbl1 and tbl2 except ONE of tbl1's or tbl2's join_attrib> from tbl1, tbl2 where tbl1.join_attrib = tbl2.join_attrib; */ select empl_num, empl_last_name, job_title, mgr, hiredate, salary, commission, empl.dept_num, dept_name, dept_loc from empl, dept where empl.dept_num = dept.dept_num;