SQL>

SP2-0042: unknown command " - rest of line ignored.
SQL> SQL> select * from jps.employee;
SP2-0734: unknown command beginning "SQL> selec..." - rest of line ignored.
SQL> select * from jps.employee;
NAME
------------------John B Smith
Franklin T Wong
Alicia J Zelaya
Jennifer S Wallace
Ramesh K Narayan
Joyce A English
Ahmad V Jabbar
James E Borg

SSN
--------123456789
333445555
999887777
987654321
666884444
453453453
987987987
888665555

BDATE
--------09-JAN-55
08-DEC-45
19-JUL-85
20-JUN-31
15-SEP-52
31-JUL-62
29-MAR-59
10-NOV-27

SEX
SALARY SUPERSSN DNO
--- ---------- --------- -------M
30000 333445555 5
M
40000 888665555 5
F
25000 987654321 4
F
43000 888665555 4
M
38000 333445555 5
F
25000 333445555 5
M
25000 987654321 4
M
55000
1

8 rows selected.
SQL> select *
2 2 from jps.employee;
2 from jps.employee
*
ERROR at line 2:
ORA-00923: FROM keyword not found where expected
SQL> select *
2 from jps.employee;
NAME
------------------John B Smith
Franklin T Wong
Alicia J Zelaya
Jennifer S Wallace
Ramesh K Narayan
Joyce A English
Ahmad V Jabbar
James E Borg

SSN
--------123456789
333445555
999887777
987654321
666884444
453453453
987987987
888665555

BDATE
--------09-JAN-55
08-DEC-45
19-JUL-85
20-JUN-31
15-SEP-52
31-JUL-62
29-MAR-59
10-NOV-27

SEX
SALARY SUPERSSN DNO
--- ---------- --------- -------M
30000 333445555 5
M
40000 888665555 5
F
25000 987654321 4
F
43000 888665555 4
M
38000 333445555 5
F
25000 333445555 5
M
25000 987654321 4
M
55000
1

8 rows selected.
SQL> clear buffer
buffer cleared
SQL> select *
2 from tab
3 where tabtype = 'TABLE';
no rows selected
SQL> select *
2 from system.tab;
no rows selected
SQL> select object_name, object_type
2 from all_objects
3 where owner = 'JPS' and object_type = 'TABLE';

OBJECT_NAME
-----------------------------BRANCH
CLIENT
DEPARTMENT
DEPENDENT
DEPTLOCATION
EMPLOYEE
LANCAP
PRIVATEOWNER
PROJECT
PROPERTYFORRENT
R

OBJECT_TYPE
------------------TABLE
TABLE
TABLE
TABLE
TABLE
TABLE
TABLE
TABLE
TABLE
TABLE
TABLE

OBJECT_NAME
-----------------------------REGISTRATION
S
STAFF
VIEWING
WORKSON

OBJECT_TYPE
------------------TABLE
TABLE
TABLE
TABLE
TABLE

16 rows selected.
SQL> describe jps.employee;
Name
----------------------------------------NAME
SSN
BDATE
SEX
SALARY
SUPERSSN
DNO

Null?
-------NOT NULL
NOT NULL

Type
---------------------------VARCHAR2(19)
CHAR(9)
DATE
CHAR(3)
NUMBER(8,2)
CHAR(9)
VARCHAR2(8)

Null?
-------NOT NULL
NOT NULL

Type
---------------------------VARCHAR2(15)
VARCHAR2(8)
CHAR(9)
DATE

Null?
-------NOT NULL
NOT NULL

Type
---------------------------CHAR(9)
VARCHAR2(15)
CHAR(3)
DATE
VARCHAR2(12)

SQL> describe jps.deptlocation;
Name
----------------------------------------DNUMBER
DLOCATION

Null?
-------NOT NULL
NOT NULL

Type
---------------------------VARCHAR2(8)
VARCHAR2(15)

SQL> describe jps.project;
Name

Null?

Type

SQL> describe jps.department;
Name
----------------------------------------DNAME
DNUMBER
MGRSSN
MGRSTARTDATE
SQL> describe jps.dependent;
Name
----------------------------------------ESSN
DEPENDENTNAME
SEX
BDATE
RELATIONSHIP

-------.----------------------------------------.---------------------------PNAME NOT NULL VARCHAR2(15) PNUMBER NOT NULL VARCHAR2(8) PLOCATION VARCHAR2(15) DNUM VARCHAR2(8) SQL> describe jps. NAME ------------------John B Smith Franklin T Wong Alicia J Zelaya Jennifer S Wallace Ramesh K Narayan Joyce A English Ahmad V Jabbar James E Borg SSN --------123456789 333445555 999887777 987654321 666884444 453453453 987987987 888665555 BDATE --------09-JAN-55 08-DEC-45 19-JUL-85 20-JUN-31 15-SEP-52 31-JUL-62 29-MAR-59 10-NOV-27 SEX SALARY SUPERSSN DNO --.workson. Name Null? ----------------------------------------.-------A B C Type ---------------------------CHAR(2) CHAR(2) CHAR(2) SQL> describe jps.s.-------B C D Type ---------------------------CHAR(2) CHAR(2) CHAR(2) SQL> select * 2 from jps. DNAME --------------Research Administration Headquarters DNUMBER -------5 4 1 MGRSSN --------333445555 987654321 888665555 MGRSTARTD --------22-MAY-78 01-JAN-85 19-JUN-71 SQL> select * 2 from jps. Name ----------------------------------------ESSN PNO HOURS Null? -------NOT NULL NOT NULL Type ---------------------------CHAR(9) VARCHAR2(8) NUMBER(5.-------M 30000 333445555 5 M 40000 888665555 5 F 25000 987654321 4 F 43000 888665555 4 M 38000 333445555 5 F 25000 333445555 5 M 25000 987654321 4 M 55000 1 8 rows selected.---------.employee. Name Null? ----------------------------------------. ESSN --------333445555 333445555 333445555 DEPENDENTNAME --------------Alice Theodore Joy SEX --F M F BDATE --------05-APR-76 25-OCT-73 03-MAY-48 RELATIONSHIP -----------Daughter Son Spouse .1) SQL> describe jps.--------. SQL> select * 2 from jps.dependent.department.r.

deptlocation.5 3 40 1 20 2 20 2 10 3 10 10 10 20 10 30 30 10 10 ESSN --------987987987 987987987 987654321 987654321 888665555 PNO HOURS -------. PNAME --------------ProductX ProductY ProductZ Computerization Reorganization Newbenefits PNUMBER -------1 2 3 10 20 30 PLOCATION --------------Bellaire Sugarland Houston Stafford Houston Stafford 6 rows selected.987654321 123456789 123456789 123456789 Abner Michael Alice Elizabeth M M F F 29-FEB-32 01-JAN-78 31-DEC-78 05-MAY-57 Spouse Son Daughter Spouse 7 rows selected. SQL> select * 2 from jps. SQL> select * 2 from jps. ESSN --------123456789 123456789 666884444 453453453 453453453 333445555 333445555 333445555 333445555 999887777 999887777 PNO HOURS -------.---------1 32.workson.---------10 35 30 5 30 20 20 15 20 16 rows selected. DNUMBER -------1 4 5 5 5 DLOCATION --------------Houston Stafford Bellaire Houston Sugarland SQL> select * 2 from jps.project. SQL> select * DNUM -------5 5 5 4 1 4 .5 2 7.

--------.--------.employee 3 where sex = 'F' and salary > 30000.-------M 40000 888665555 5 F 43000 888665555 4 M 38000 333445555 5 M 55000 1 SQL> select * 2 from jps. NAME ------------------John B Smith Franklin T Wong Ramesh K Narayan Joyce A English SSN --------123456789 333445555 666884444 453453453 BDATE --------09-JAN-55 08-DEC-45 15-SEP-52 31-JUL-62 SEX SALARY SUPERSSN DNO --.--------.---------. NAME SSN BDATE SEX SALARY SUPERSSN DNO ------------------. B -b1 b1 C -c1 c3 D -d1 d2 SQL> select * 2 from jps.--------. A -a1 a1 B -b1 b2 C -c1 c2 SQL> select * 2 from jps. .pno = 1 or w.workson w 3 where w.5 2 7.pno = 3.pno = 2 or w.---------. NAME ------------------Franklin T Wong Jennifer S Wallace Ramesh K Narayan James E Borg SSN --------333445555 987654321 666884444 888665555 SQL> select * 2 from jps.--.-------M 30000 333445555 5 M 40000 888665555 5 M 38000 333445555 5 F 25000 333445555 5 BDATE --------08-DEC-45 20-JUN-31 15-SEP-52 10-NOV-27 SEX SALARY SUPERSSN DNO --.-------Jennifer S Wallace 987654321 20-JUN-31 F 43000 888665555 4 SQL> select * 2 from jps.r.5 3 40 1 20 2 20 2 10 3 10 7 rows selected.2 from jps.employee 3 where dno = 5.employee 3 where salary > 30000.s.---------.---------1 32.--------. ESSN --------123456789 123456789 666884444 453453453 453453453 333445555 333445555 PNO HOURS -------.

3)).workson w 3 where w.ssn in (select w.2.ssn from jps.employee e where e.ssn in (select w.essn. e.pno not in (1. SQL> select e.2. NAME ------------------John B Smith John B Smith Franklin T Wong Franklin T Wong Joyce A English Joyce A English Ramesh K Narayan SSN --------123456789 123456789 333445555 333445555 453453453 453453453 666884444 7 rows selected.2.essn from jps.3)).ssn from jps.employee e.3).ssn = w.---------1 32.name. jps.pno in (1.5 3 40 1 20 2 20 2 10 3 10 7 rows selected.2.name.pno in (1. SQL> 2 3 4 5 select e.workson w 3 where w. e.essn from jps.employee e where e.3) and e.name.workson w where w.SQL> select * 2 from jps. NAME ------------------Franklin T Wong James E Borg Jennifer S Wallace Ahmad V Jabbar Alicia J Zelaya SSN --------333445555 888665555 987654321 987987987 999887777 .ssn 2 from jps.5 2 7. e. NAME ------------------John B Smith Franklin T Wong Joyce A English Ramesh K Narayan SQL> 2 3 4 5 SSN --------123456789 333445555 453453453 666884444 select e. ESSN --------123456789 123456789 666884444 453453453 453453453 333445555 333445555 PNO HOURS -------.workson w where w.pno in (1.

name. e.workson w where w.3) and e.3)).ssn from jps. NAME ------------------James E Borg Jennifer S Wallace Ahmad V Jabbar Alicia J Zelaya SQL> 2 3 4 5 6 SSN --------888665555 987654321 987987987 999887777 select e.name.pno in (1.ssn from jps.3)).pno in (1.3) and e.ssn not in (select w.ssn not in (select w.ssn from jps.employee e where e.essn).superssn) 2 from jps.ssn = w.essn from jps.workson w where w.ssn from jps.2. e.2.2.name.essn).employee e where exists (select * from jps.SQL> 2 3 4 5 select e.employee e. NAME ------------------James E Borg Jennifer S Wallace Ahmad V Jabbar Alicia J Zelaya SQL> 2 3 4 5 select e.2.pno in (1. NAME ------------------John B Smith Franklin T Wong Joyce A English Ramesh K Narayan SQL> 2 3 4 5 6 SSN --------888665555 987654321 987987987 999887777 SSN --------123456789 333445555 453453453 666884444 select e.workson w where w.pno in (1.ssn = w.employee e where not exists (select * from jps.essn from jps.employee e where e. e.name. SUPERSSN --------987654321 .workson w where w. NAME ------------------James E Borg Jennifer S Wallace Ahmad V Jabbar Alicia J Zelaya SSN --------888665555 987654321 987987987 999887777 SQL> select distinct (e. e.

department. NAME ------------------John B Smith Franklin T Wong Alicia J Zelaya Jennifer S Wallace Ramesh K Narayan Joyce A English Ahmad V Jabbar James E Borg SSN --------123456789 333445555 999887777 987654321 666884444 453453453 987987987 888665555 BDATE --------09-JAN-55 08-DEC-45 19-JUL-85 20-JUN-31 15-SEP-52 31-JUL-62 29-MAR-59 10-NOV-27 8 rows selected. mgrssn.888665555 333445555 SQL> select * 2 from jps.--.employee 3 where mgrssn = ssn.--------. .--------.---------.-------M 40000 888665555 5 F 43000 888665555 4 SQL> select name.employee.department. NAME ------------------John B Smith Franklin T Wong Ramesh K Narayan Joyce A English SSN SALARY --------.employee e 3 where e. ssn.employee 3 where dno = 5. NAME ------------------Franklin T Wong Jennifer S Wallace SSN --------333445555 987654321 BDATE --------08-DEC-45 20-JUN-31 SEX SALARY SUPERSSN DNO --.name like '%Wong'.-------M 30000 333445555 5 M 40000 888665555 5 F 25000 987654321 4 F 43000 888665555 4 M 38000 333445555 5 F 25000 333445555 5 M 25000 987654321 4 M 55000 1 SQL> select dnumber. name 2 from jps. SEX SALARY SUPERSSN DNO --.---------. DNAME --------------Research Administration Headquarters DNUMBER -------5 4 1 MGRSSN --------333445555 987654321 888665555 MGRSTARTD --------22-MAY-78 01-JAN-85 19-JUN-71 SQL> select * 2 from jps.--------. dname. salary 2 from jps.name like '%W%'. NAME SSN BDATE SEX SALARY SUPERSSN DNO ------------------.-------Franklin T Wong 333445555 08-DEC-45 M 40000 888665555 5 SQL> select * 2 from jps.--------.--------.employee e 3 where e. jps.---------.---------123456789 30000 333445555 40000 666884444 38000 453453453 25000 SQL> select * 2 from jps.

superssn = s. NAME ------------------John B Smith Franklin T Wong Alicia J Zelaya Jennifer S Wallace Ramesh K Narayan Joyce A English Ahmad V Jabbar James E Borg SSN --------123456789 333445555 999887777 987654321 666884444 453453453 987987987 888665555 BDATE --------09-JAN-55 08-DEC-45 19-JUL-85 20-JUN-31 15-SEP-52 31-JUL-62 29-MAR-59 10-NOV-27 SEX SALARY SUPERSSN DNO --.superssn = s. s.ssn (+).--------.employee e 3 where d.employee s 3 where e. DNUMBER -------5 1 4 DNAME --------------Research Headquarters Administration MGRSSN --------333445555 888665555 987654321 NAME ------------------Franklin T Wong James E Borg Jennifer S Wallace SQL> select * from jps.ssn.employee.mgrssn.dnumber. s. e.name 2 from jps.ssn.mgrssn = e. SSN --------666884444 123456789 453453453 333445555 987654321 999887777 987987987 NAME ------------------Ramesh K Narayan John B Smith Joyce A English Franklin T Wong Jennifer S Wallace Alicia J Zelaya Ahmad V Jabbar SSN --------333445555 333445555 333445555 888665555 888665555 987654321 987654321 NAME ------------------Franklin T Wong Franklin T Wong Franklin T Wong James E Borg James E Borg Jennifer S Wallace Jennifer S Wallace 7 rows selected.ssn. jps.ssn. s. SQL> select e.name.employee e. SQL> select e. SSN --------453453453 666884444 123456789 987987987 999887777 987654321 NAME ------------------Joyce A English Ramesh K Narayan John B Smith Ahmad V Jabbar Alicia J Zelaya Jennifer S Wallace SSN --------333445555 333445555 333445555 987654321 987654321 888665555 NAME ------------------Franklin T Wong Franklin T Wong Franklin T Wong Jennifer S Wallace Jennifer S Wallace James E Borg .DNUMBER -------5 1 4 DNAME --------------Research Headquarters Administration MGRSSN --------333445555 888665555 987654321 NAME ------------------Franklin T Wong James E Borg Jennifer S Wallace SQL> select d.ssn.employee e. d.---------.name 2 from jps.department d. e. s. d.-------M 30000 333445555 5 M 40000 888665555 5 F 25000 987654321 4 F 43000 888665555 4 M 38000 333445555 5 F 25000 333445555 5 M 25000 987654321 4 M 55000 1 8 rows selected.name.ssn. e. jps.employee s 3 where e.dname. jps.name 2 from jps.

superssn. SQL> 2 3 4 5 6 select e. SUPERVISO --------123456789 333445555 333445555 333445555 453453453 666884444 888665555 888665555 987654321 987654321 987987987 SUPERVISORNAME ------------------John B Smith Franklin T Wong Franklin T Wong Franklin T Wong Joyce A English Ramesh K Narayan James E Borg James E Borg Jennifer S Wallace Jennifer S Wallace Ahmad V Jabbar EMPLOYEES EMPLOYEENAME --------.name as employeename from jps. s.------------------.employee s 3 where s.ssn as supervisorssn. jps.name as supervisorname.employee e.name = 'James E Borg').employee e. SQL> 2 3 4 5 6 select s.ssn from jps. SSN --------453453453 666884444 123456789 987987987 999887777 987654321 333445555 888665555 NAME ------------------Joyce A English Ramesh K Narayan John B Smith Ahmad V Jabbar Alicia J Zelaya Jennifer S Wallace Franklin T Wong James E Borg SSN --------333445555 333445555 333445555 987654321 987654321 888665555 888665555 NAME ------------------Franklin T Wong Franklin T Wong Franklin T Wong Jennifer S Wallace Jennifer S Wallace James E Borg James E Borg 8 rows selected.name.--------.superssn (+).ssn.ssn (+) = e.ssn. SSN --------333445555 987654321 .superssn in (select s. e. SQL> select e. jps.ssn as employeessn.333445555 Franklin T Wong 888665555 James E Borg 888665555 James E Borg 8 rows selected.name 2 from jps. e. s.------------------999887777 Alicia J Zelaya 12 rows selected.ssn from jps. e.employee e where e.employee s where s.------------------666884444 Ramesh K Narayan 123456789 John B Smith 453453453 Joyce A English 333445555 987654321 999887777 987987987 Franklin T Wong Jennifer S Wallace Alicia J Zelaya Ahmad V Jabbar SUPERVISO SUPERVISORNAME EMPLOYEES EMPLOYEENAME --------.ssn = e.employee s where s. s.

superssn in (select s2.employee e where superssn in (select ssn from jps.name = 'James E Borg') union select e2.employee s where s.employee s3 where s3.employee s2 where s2.employee e3 where e3.name = 'Jennifer S Wallace').rest of line ignored.ssn from jps.ssn from jps. SQL> select e.employee e2 where e2.ssn from jps.ssn from jps.ssn 2 from jps. SSN --------999887777 987987987 SQL> 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 select e1. SSN --------123456789 333445555 453453453 666884444 987654321 987987987 999887777 7 rows selected.employee e 3 where e. .SQL> J SP2-0042: unknown command "J" .ssn from jps.name = 'Jennifer S Wallace').superssn in (select s3.name = 'Franklin T Wong') union select e3. SSN --------666884444 123456789 453453453 SQL> 2 3 4 5 6 select e.ssn from jps.superssn in (select s1.ssn from jps.superssn in 4 (select ssn 5 from jps.employee e1 where e1.employee s1 where s1.employee 6 where name = 'Franklin T Wong').

employee s1 where s1.superssn in (select s2.ssn from jps.ssn from jps.ssn from jps.ssn from jps.employee e where e.ssn from jps. SSN --------333445555 987654321 SQL> 2 3 4 5 6 7 8 9 select e1.superssn in (select s2.superssn in (select s1.SQL> 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 select e.superssn in (select s.employee e1 where e1.employee s2 where s2.employee s where s.employee e1 where e1.ssn from jps.name = 'James E Borg') union select e1.name = 'James E Borg')).employee e where e. SSN --------123456789 999887777 666884444 453453453 987987987 . SSN --------123456789 333445555 453453453 666884444 987654321 987987987 999887777 7 rows selected.ssn from jps.superssn in (select s. SQL> 2 3 4 5 6 select e.superssn in (select s1.ssn from jps.employee s where s.name = 'James E Borg').ssn from jps.ssn from jps.employee s1 where s1.name = 'James E Borg')).employee s2 where s2.

superssn = prior e.employee e start with e. (level .name = 'Jennifer S Wallace' connect by e.1) * 2) || ssn as padded_ssn from jps. 2 3 4 PADDED_SSN -------------------------------------------------------------------------------888665555 333445555 123456789 453453453 666884444 987654321 987987987 999887777 8 rows selected.employee where name = 'James E Borg'). SSN --------333445555 123456789 453453453 666884444 SQL> 2 3 4 select e. SQL> 2 3 4 select e.employee 3 connect by prior ssn = superssn 4 start with ssn in (select ssn 5 from jps. (level .SQL> SQL> SQL> select lpad(' '.1) * 2) || ssn as padded_ssn from jps.employee e start with e.ssn.employee where name = 'James E Borg') select 1pad(' '.employee 6 where name = 'James E Borg') 7 SQL> select lpad(' '.1) * 2) || ssn as padded_ssn 2 from jps. (level .ssn.employee connect by prior ssn = superssn start with ssn in (select ssn from jps.ssn from jps.employee e connect by prior ssn = superssn start with ssn in (select ssn from jps.name = 'Franklin T Wong' connect by e. (level .superssn = prior e. SSN --------987654321 987987987 999887777 SQL> 2 3 4 5 6 7 SQL> select lpad(' '.ssn from jps.1) * 2) || ssn as padded_ssn .

ssn from jps. 2 SSN --------453453453 666884444 888665555 987987987 999887777 SQL> 2 3 4 5 6 7 8 select ssn. SQL> select e.project where dnum = 5) minus (select pno from jps.employee where name = 'James E Borg'). 2 3 4 5 3 4 5 SSN --------123456789 333445555 987654321 SQL> select e.employee e 3 connect by prior ssn = superssn 4 start with ssn in (select ssn 5 from jps.ssn from jps.employee e connect by prior ssn = superssn start with ssn in (select ssn from jps.1) * 2) || ssn as padded_ssn from jps.2 from jps.dependent d.employee e where not exists ((select pnumber from jps.employee e intersect select d.essn from jps.name from jps.dependent d.essn from jps.employee e minus select d.employee 6 where name = 'James E Borg') 7 SQL> select lpad(' '.workson w . (level . 2 3 4 5 6 PADDED_SSN -------------------------------------------------------------------------------888665555 333445555 123456789 453453453 666884444 987654321 987987987 999887777 8 rows selected.

essn)).employee e1 where e1.workson w where e.essn). where e.9 where e.workson w 3 where e.ssn = w.essn) * ERROR at line 3: ORA-00933: SQL command not properly ended SQL> select pno 2 from jps. no rows selected SQL> select pnumber 2 from jps. .workson w 3 where e.workson w1. PNUMBER -------1 2 3 SQL> select pno 2 from jps.essn)).ssn = w.project 3 where dnum = 5.essn) * ERROR at line 3: ORA-00933: SQL command not properly ended SQL> 2 3 4 5 6 7 8 9 10 select ssn.ssn = w.workson w 3 where e.essn).ssn = w.ssn = w. where e.R.ssn = w.ssn = w. jps.essn). where e.ssn = w1.name = 'John B Smith' and e1.employee e where not exists ((select pno from jps.name from jps. SSN --------123456789 453453453 NAME ------------------John B Smith Joyce A English SQL> select * 2 2 from jps.ssn = w.essn) * ERROR at line 3: ORA-00933: SQL command not properly ended SQL> select pno 2 from jps.essn) minus (select pno from jps.

B C A D -.R join jps.-.R.S on jps.-.C = jps.2 from jps.-.S.R join jps.S.C. A B C B C D -. A -a1 a1 a1 a1 B -b1 b1 b2 b2 C -c1 c1 c2 c2 B -b1 b1 b1 b1 C -c1 c3 c1 c3 D -d1 d2 d1 d2 SQL> select * 2 from jps.S on jps.C = jps.R natural join jps.R.S.C.-a1 b1 c1 b1 c1 d1 SQL> select * 2 from jps.R.R * ERROR at line 2: ORA-00923: FROM keyword not found where expected SQL> select * 2 from jps.-a1 b1 c1 b1 c1 d1 SQL> select * 2 from jps.S.-. A -a1 a1 B -b1 b1 C -c1 c1 B -b1 b1 C -c1 c3 D -d1 d2 SQL> select * 2 from jps.-.R cross join jps.B = jps.S on jps.-.R.-. B -b1 b1 C -c1 c3 D -d1 d2 SQL> select * 2 from jps. A -a1 a1 B -b1 b2 C -c1 c2 SQL> select * 2 from jps.-.S.-.-b1 c1 a1 d1 .R inner join jps.B.S.-. A B C B C D -.

-a1 b1 c1 b1 b1 C -c1 c3 D -d1 d2 SQL> select * 2 from jps.C.B = jps.R left outer join jps.B. C.S.-.B.-a1 b1 c1 d1 SQL> select * 2 from jps.-.S on jps.S on jps.R.-a1 b1 c1 b1 b1 a1 b2 c2 C -c1 c3 SQL> select * D -d1 d2 .S on jps.S.R natural join jps.R.-.C. A -a1 a1 a1 B -b1 b1 b2 C -c1 c1 c2 B -b1 b1 C -c1 c3 D -d1 d2 SQL> select * 2 from jps.C = jps. D 2 from jps. A B C D -.R left outer join jps.R.S. A -a1 a1 a1 B -b1 b1 b2 C -c1 c1 c2 B -b1 b1 C -c1 c3 D -d1 d2 SQL> select * 2 from jps.-.-.S on jps.-c1 b1 c1 d1 c2 SQL> select * 2 from jps.C. A -a1 a1 B -b1 b2 C B C D -.C = jps.R right outer join jps.-.B.S.R.S.S on jps.R right outer join jps.B = jps. B.R.-.-. A -a1 a1 B -b1 b1 C -c1 c1 B -b1 b1 C -c3 c1 D -d2 d1 SQL> select * 2 from jps. A B C B -.R full outer join jps.R. A B C B -.B = jps.S.S.S on jps.C = jps.R full outer join jps.SQL> select A.

A B C B -.----------35125 25000 55000 281000 SQL> select count(ssn).R full outer join jps. count(ssn).C = jps.'5').max(salary).employee. dno varchar(8).'123456789'.employee 3 group by dno.'M'.30000.'333445555'. Table created.employee 3 where dno = 5. count(ssn).employee group by dno having count(ssn) > 1.min(salary). sum(salary) from jps.---------. avg(salary).R.----------1 1 55000 55000 5 4 33250 133000 4 3 31000 93000 SQL> 2 3 4 select dno. COUNT(SSN) AVG(SALARY) SUM(SALARY) ---------. DNO COUNT(SSN) AVG(SALARY) SUM(SALARY) -------. bdate date.S. DNO COUNT(SSN) AVG(SALARY) SUM(SALARY) -------. ssn char (9). AVG(SALARY) MIN(SALARY) MAX(SALARY) SUM(SALARY) ----------.----------. . superssn char(9). constraint empPK primary key (ssn)).----------.sum(salary) 2 from jps. avg(salary).'09-JAN 55'.R. sum(salary) 2 from jps.B and jps.----------4 33250 133000 SQL> select dno. salary number(8.----------.-.2). avg(salary).S on jps.S.----------.---------. sum(salary) 2 from jps.C.-a1 b1 c1 b1 b1 a1 b2 c2 C -c1 c3 D -d1 d2 SQL> select avg(salary). SQL> insert into EMPLOYEE values 2 ('John B Smith'.B = jps. sex char(3).-.----------.2 3 from jps. 1 row created.----------5 4 33250 133000 4 3 31000 93000 SQL> 2 3 4 5 6 7 8 9 create table EMPLOYEE ( name varchar2(19) not null.

SQL> insert into EMPLOYEE values 2 ('Ramesh K Narayan'.25000.' '.38000.43000. SQL> delete from employee.'15-SEP-52'.'5').'M'.'987654321'.55000.'4'). SQL> insert into EMPLOYEE values 2 ('Alicia J Zelaya'.employee.'4').'F'. .'F'.'1').'20-JUN-31'. SQL> insert into employee 2 select * from jps.'M'.'F'.'4').employee 3 SQL> delete from employee.'5'). 1 row created.'888665555'.'333445555'.'5').employee. 1 row created. SQL> SQL> insert into employee 2 select * from jps.'987987987'.'10-NOV-27'.'453453453'.'M'.'666884444'. SQL> insert into EMPLOYEE values 2 ('Joyce A English'. 1 row created.25000. SQL> select * from employee. 8 rows created.'999887777'. 1 row created.'888665555'. SQL> insert into employee 2 select * from jps.'987654321'. 1 row created.'M'.SQL> insert into EMPLOYEE values 2 ('Franklin T Wong'.'333445555'. 8 rows created.'29-MAR-59'.25000.40000. SQL> insert into EMPLOYEE values 2 ('Jennifer S Wallace'. SQL> insert into EMPLOYEE values 2 ('Ahmad V Jabbar'. SQL> insert into EMPLOYEE values 2 ('James E Borg'.'31-JUL-62'. 8 rows deleted. 8 rows deleted. 1 row created.'08-DEC-45'.'987654321'.'333445555'.'19-JUL-85'.'888665555'. 1 row created.

SQL> drop table employee cascade constraints. OWNER -----------------------------JPS JPS JPS CONSTRAINT_NAME -----------------------------EMPSUPERFRK EMPPK SYS_C0011008 SQL> drop table employee.NAME ------------------John B Smith Franklin T Wong Alicia J Zelaya Jennifer S Wallace Ramesh K Narayan Joyce A English Ahmad V Jabbar James E Borg SSN --------123456789 333445555 999887777 987654321 666884444 453453453 987987987 888665555 BDATE --------09-JAN-55 08-DEC-45 19-JUL-85 20-JUN-31 15-SEP-52 31-JUL-62 29-MAR-59 10-NOV-27 SEX SALARY SUPERSSN DNO --.--------. SQL> delete from employee 2 where name = 'Franklin T Wong'. Flashback complete. SQL> select owner. constraint_name 2 from user_constraints 3 where owner = 'JPS' and table_name = 'EMPLOYEE'.---------. drop table employee cascade constraints * ERROR at line 1: ORA-00942: table or view does not exist SQL> drop table employee cascade constraints. 1 row deleted. SQL> SQL> purge recyclebin. drop table employee cascade constraints * ERROR at line 1: ORA-00942: table or view does not exist SQL> flashback table employee to before drop. Recyclebin purged. Table dropped.-------M 30000 333445555 5 M 40000 888665555 5 F 25000 987654321 4 F 43000 888665555 4 M 38000 333445555 5 F 25000 333445555 5 M 25000 987654321 4 M 55000 1 8 rows selected. . constraint_name 2 from all_constraints 3 where owner = 'JPS' and table_name = 'EMPLOYEE'. no rows selected SQL> select owner.

SQL> spool off . Table dropped.SQL> drop table employee purge.

Sign up to vote on this title
UsefulNot useful