Tables:
>> select * from course;
COURSENO | CNAME | CDATE |
1 | Basic Accounting | 11-JAN-89 |
2 | Further Accounting | 25-JAN-89 |
3 | Issues In Administration | 27-SEP-88 |
4 | More Administration | 16-OCT-88 |
5 | Ada | 01-NOV-88 |
6 | Introduction To Ingres | 05-FEB-89 |
7 | New Topologies | 10-MAR-89 |
8 | LANs | 12-DEC-88 |
9 | Structural Stress Analysis | 20-FEB-89 |
10 | Taffic Flow Analysis | 24-OCT-88 |
>> select * from department;
DEPNO | DNAME | LOCATION | HEAD |
1 | accounts | floor 3 | 5 |
2 | administration | floor 2 | 5 |
3 | software design | floor 1 | 2 |
4 | communications | floor 4 | 3 |
5 | engineering | floor 5 | 7 |
>> select * from empcourse;
EMPNO | COURSENO |
2 | 1 |
2 | 2 |
2 | 4 |
5 | 1 |
5 | 2 |
7 | 3 |
7 | 4 |
8 | 3 |
8 | 4 |
14 | 5 |
14 | 6 |
15 | 5 |
15 | 6 |
19 | 5 |
19 | 6 |
21 | 7 |
22 | 7 |
22 | 8 |
25 | 6 |
32 | 5 |
>> select * from employee;
EMPNO | SURNAME | FORENAMES | DOB | ADDRESS | TELNO | DEPNO |
5 | Jones | Elizabeth Barbara | 05-JAN-44 | 26 Agnews Terrace, Shamrock Bay | 212 337 2288 | 1 |
2 | Smith | Robert | 07-FEB-47 | 18 Marsh Street, Tollcross, Edinburgh | 031 732 8972 | 1 |
3 | White | Allan | 05-MAY-61 | 6 Remote Place, North Berwick | 121 555 6622 | 1 |
4 | Reid | Gordon | 10-AUG-63 | 9 Noble Road, Penicuik | 629 424 6713 | 1 |
1 | MacCallan | Claire | 18-SEP-58 | 25 Crisis Avenue, Leith, Edinburgh | 031 337 4166 | 1 |
... |
select address from employee where surname='Smith' and forenames='Robert';
select telno from employee where surname='White' and forenames='Allan';
select location from department where dname='engineering';
select dname from department where location='floor 2';
select dname from employee, department
where employee.depno=department.depno and surname='Smith' and forenames='Robert';
select surname, forenames from employee, department
where employee.depno=department.depno and dname='accounts';
select location from employee, department
where employee.depno=department.depno and surname='Reid' and forenames='Gordon';
select surname, forenames, telno from employee, department
where employee.depno=department.depno and location='floor 1';
select surname, forenames from course, empcourse, employee
where empcourse.courseno=course.courseno and empcourse.empno=employee.empno and cname='Ada';
select cname from course, empcourse, employee
where empcourse.courseno=course.courseno and empcourse.empno=employee.empno and surname='Smith' and forenames='Robert';
select surname, forenames, cname from course, empcourse, employee, department where department.depno=employee.depno and empcourse.courseno=course.courseno and empcourse.empno=employee.empno and location='floor 2';