SlideShare a Scribd company logo
1 of 12
Download to read offline
Here is the company database for the problem
--comments can be added
DROP TABLE works_on;
DROP TABLE dependent;
DROP TABLE project;
DROP TABLE dept_location;
ALTER TABLE department DROP CONSTRAINT fk_mgrssn CASCADE;
ALTER TABLE employee DROP CONSTRAINT fk_dno CASCADE;
DROP TABLE department;
DROP TABLE employee;
CREATE TABLE employee
(fnameVARCHAR2(12),
minitCHAR(1),
lnameVARCHAR2(12),
ssnCHAR(9) NOT NULL,
bdateDATE,
addressVARCHAR2(40),
sexCHAR(1),
salaryNUMBER(7) NOT NULL,
superssnCHAR(9) references employee(ssn),
/*superssnCHAR(9),*/
/*either way, but need to know superssn is from ssn*/
CONSTRAINT pk_ssn PRIMARY KEY (SSN));
ALTER TABLE employee ADD (dno NUMBER(2) NOT NULL);
INSERT INTO employee VALUES ('Wolons', 'E', 'Aimee', '888665555',
'10-NOV-1927', '450 Stone, edsion, NJ', 'F', 55000, null,1);
INSERT INTO employee VALUES ('Ramirez', '', 'Damian', '987654321',
'20-JUN-1931', '291 Berry, albany, NY', 'M', 43000, '888665555',4);
INSERT INTO employee VALUES ('Hall', '', 'Nathan', '333445555',
'09-DEC-1945', '638 bruce, Oneonta, NY', 'M', 40000, '888665555',5);
INSERT INTO employee VALUES ('Kelly', '', 'David', '999778888',
'19-JUL-1958', '3321 central ave, New York, NY', 'M', 25000, '987654321',4);
INSERT INTO employee VALUES ('Philip', '', 'Dolensek', '123456789',
'09-JAN-1955', '731 clinton, Oneonta, NY', 'M', 30000, '333445555',5);
INSERT INTO employee VALUES ('Reale', '', 'Michael', '666884444',
'15-SEP-1952', '975 Fire Oak, Newark, NJ', 'M', 38000, '333445555',5);
INSERT INTO employee VALUES ('Smith', '', 'Jason', '453453453',
'31-JUL-1962', '5631 Rice, Harrison, NJ', 'F', 25000, '333445555',5);
INSERT INTO employee VALUES ('Warren', 'V', 'Samantha', '987987987',
'29-MAR-1959', '908 Dallas, albany, NY', 'F', 25000, '987654321',4);
select e.fname, e.lname, s.fname, s.lname
from employee e, employee s
where e.superssn=s.ssn;
CREATE TABLE department
(dnameVARCHAR2(20) NOT NULL,
dnumberNUMBER(2) NOT NULL,
mgrssnCHAR(9) NOT NULL,
mgrstartdateDATE,
CONSTRAINT pk_dnumber PRIMARY KEY (DNUMBER),
CONSTRAINT fk_mgrssn FOREIGN KEY (mgrssn) REFERENCES employee (ssn));
INSERT INTO department VALUES ('Research',5 , '333445555', '22-MAY-1978');
INSERT INTO department VALUES ('Administration',4 , '987654321', '01-JAN-1985');
INSERT INTO department VALUES ('Computing Service', 1, '888665555', '19-JUN-1971');
ALTER TABLE employee ADD (CONSTRAINT fk_dno FOREIGN KEY (dno)
REFERENCES department(dnumber));
CREATE TABLE dept_location
(dnumberNUMBER(2) ,
dlocationVARCHAR2(20),
CONSTRAINT pk_num_loc PRIMARY key (dnumber, dlocation),
CONSTRAINT fk_dnumber FOREIGN KEY (dnumber) REFERENCES department(dnumber));
INSERT INTO dept_location VALUES (1,'Fitzelle');
INSERT INTO dept_location VALUES (4,'Hunt union');
INSERT INTO dept_location VALUES (5,'Natza');
INSERT INTO dept_location VALUES (5,'Hunt union');
INSERT INTO dept_location VALUES (5,'Fitzelle');
CREATE TABLE project
(pnameVARCHAR2(15),
pnumberNUMBER(2) NOT NULL,
plocationVARCHAR2(15) ,
dnumNUMBER(2),
CONSTRAINT pk_pnumber PRIMARY KEY (PNUMBER),
CONSTRAINT fk_dnum FOREIGN KEY (dnum) REFERENCES department(dnumber));
INSERT INTO project VALUES ('ProductX', 1,'library',5);
INSERT INTO project VALUES ('ProductY', 2,'Fitzelle hall',5);
INSERT INTO project VALUES ('ProductZ', 3,'Library',5);
INSERT INTO project VALUES ('Computerization', 10,'IRC',4);
INSERT INTO project VALUES ('Reorganization', 20,'IRC',1);
INSERT INTO project VALUES ('Newbenefits', 30,'Hunt Union',4);
CREATE TABLE dependent
(essnCHAR(9) NOT NULL,
dependent_name VARCHAR(9) NOT NULL,
sexVARCHAR2(1),
bdateDATE,
relationshipVARCHAR(8),
CONSTRAINT pk_essn PRIMARY KEY (essn, dependent_name),
CONSTRAINT fk_essn FOREIGN KEY (essn) REFERENCES employee(ssn) ON DELETE
CASCADE);
INSERT INTO dependent VALUES ('333445555','Alice', 'F','05-APR-1976','Daughter');
INSERT INTO dependent VALUES ('333445555','Theodore', 'M','10-OCT-1973','Son');
INSERT INTO dependent VALUES ('333445555','Joy', 'F','03-MAY-1948','Spouse');
INSERT INTO dependent VALUES ('987654321','Abner', 'M','29-FEB-1932','Spouse');
INSERT INTO dependent VALUES ('123456789','John', 'M','01-JAN-1978','Son');
INSERT INTO dependent VALUES ('123456789','Alice', 'M','31-DEC-1978','Daughter');
INSERT INTO dependent VALUES ('123456789','Elizabeth', 'F','05-MAY-
1957','Spouse');
CREATE TABLE works_on
(essnCHAR(9) NOT NULL,
pnoNUMBER(2) NOT NULL,
hoursNUMBER(3,1),
CONSTRAINT pk_essn_pno PRIMARY KEY (essn, pno),
CONSTRAINT fk_pno FOREIGN KEY (pno) REFERENCES project(pnumber));
INSERT INTO works_on VALUES ('123456789',1,32.5);
INSERT INTO works_on VALUES ('123456789',2,7.5);
INSERT INTO works_on VALUES ('666884444',3,40.0);
INSERT INTO works_on VALUES ('453453453',1,20.0);
INSERT INTO works_on VALUES ('453453453',2,20.0);
INSERT INTO works_on VALUES ('333445555',2,10.0);
INSERT INTO works_on VALUES ('333445555',3,10.0);
INSERT INTO works_on VALUES ('333445555',10,10.0);
INSERT INTO works_on VALUES ('333445555',20,10.0);
INSERT INTO works_on VALUES ('999887777',30,30.0);
INSERT INTO works_on VALUES ('999887777',10,10.0);
INSERT INTO works_on VALUES ('987987987',10,35.0);
INSERT INTO works_on VALUES ('987987987',30,5.0);
INSERT INTO works_on VALUES ('987654321',30,20.0);
INSERT INTO works_on VALUES ('987654321',20,15.0);
INSERT INTO works_on VALUES ('888665555',20,null);
--comments can be added
DROP TABLE works_on;
DROP TABLE dependent;
DROP TABLE project;
DROP TABLE dept_location;
ALTER TABLE department DROP CONSTRAINT fk_mgrssn CASCADE;
ALTER TABLE employee DROP CONSTRAINT fk_dno CASCADE;
DROP TABLE department;
DROP TABLE employee;
CREATE TABLE employee
(fnameVARCHAR2(12),
minitCHAR(1),
lnameVARCHAR2(12),
ssnCHAR(9) NOT NULL,
bdateDATE,
addressVARCHAR2(40),
sexCHAR(1),
salaryNUMBER(7) NOT NULL,
superssnCHAR(9) references employee(ssn),
/*superssnCHAR(9),*/
/*either way, but need to know superssn is from ssn*/
CONSTRAINT pk_ssn PRIMARY KEY (SSN));
ALTER TABLE employee ADD (dno NUMBER(2) NOT NULL);
INSERT INTO employee VALUES ('Wolons', 'E', 'Aimee', '888665555',
'10-NOV-1927', '450 Stone, edsion, NJ', 'F', 55000, null,1);
INSERT INTO employee VALUES ('Ramirez', '', 'Damian', '987654321',
'20-JUN-1931', '291 Berry, albany, NY', 'M', 43000, '888665555',4);
INSERT INTO employee VALUES ('Hall', '', 'Nathan', '333445555',
'09-DEC-1945', '638 bruce, Oneonta, NY', 'M', 40000, '888665555',5);
INSERT INTO employee VALUES ('Kelly', '', 'David', '999778888',
'19-JUL-1958', '3321 central ave, New York, NY', 'M', 25000, '987654321',4);
INSERT INTO employee VALUES ('Philip', '', 'Dolensek', '123456789',
'09-JAN-1955', '731 clinton, Oneonta, NY', 'M', 30000, '333445555',5);
INSERT INTO employee VALUES ('Reale', '', 'Michael', '666884444',
'15-SEP-1952', '975 Fire Oak, Newark, NJ', 'M', 38000, '333445555',5);
INSERT INTO employee VALUES ('Smith', '', 'Jason', '453453453',
'31-JUL-1962', '5631 Rice, Harrison, NJ', 'F', 25000, '333445555',5);
INSERT INTO employee VALUES ('Warren', 'V', 'Samantha', '987987987',
'29-MAR-1959', '908 Dallas, albany, NY', 'F', 25000, '987654321',4);
select e.fname, e.lname, s.fname, s.lname
from employee e, employee s
where e.superssn=s.ssn;
CREATE TABLE department
(dnameVARCHAR2(20) NOT NULL,
dnumberNUMBER(2) NOT NULL,
mgrssnCHAR(9) NOT NULL,
mgrstartdateDATE,
CONSTRAINT pk_dnumber PRIMARY KEY (DNUMBER),
CONSTRAINT fk_mgrssn FOREIGN KEY (mgrssn) REFERENCES employee (ssn));
INSERT INTO department VALUES ('Research',5 , '333445555', '22-MAY-1978');
INSERT INTO department VALUES ('Administration',4 , '987654321', '01-JAN-1985');
INSERT INTO department VALUES ('Computing Service', 1, '888665555', '19-JUN-1971');
ALTER TABLE employee ADD (CONSTRAINT fk_dno FOREIGN KEY (dno)
REFERENCES department(dnumber));
CREATE TABLE dept_location
(dnumberNUMBER(2) ,
dlocationVARCHAR2(20),
CONSTRAINT pk_num_loc PRIMARY key (dnumber, dlocation),
CONSTRAINT fk_dnumber FOREIGN KEY (dnumber) REFERENCES department(dnumber));
INSERT INTO dept_location VALUES (1,'Fitzelle');
INSERT INTO dept_location VALUES (4,'Hunt union');
INSERT INTO dept_location VALUES (5,'Natza');
INSERT INTO dept_location VALUES (5,'Hunt union');
INSERT INTO dept_location VALUES (5,'Fitzelle');
CREATE TABLE project
(pnameVARCHAR2(15),
pnumberNUMBER(2) NOT NULL,
plocationVARCHAR2(15) ,
dnumNUMBER(2),
CONSTRAINT pk_pnumber PRIMARY KEY (PNUMBER),
CONSTRAINT fk_dnum FOREIGN KEY (dnum) REFERENCES department(dnumber));
INSERT INTO project VALUES ('ProductX', 1,'library',5);
INSERT INTO project VALUES ('ProductY', 2,'Fitzelle hall',5);
INSERT INTO project VALUES ('ProductZ', 3,'Library',5);
INSERT INTO project VALUES ('Computerization', 10,'IRC',4);
INSERT INTO project VALUES ('Reorganization', 20,'IRC',1);
INSERT INTO project VALUES ('Newbenefits', 30,'Hunt Union',4);
CREATE TABLE dependent
(essnCHAR(9) NOT NULL,
dependent_name VARCHAR(9) NOT NULL,
sexVARCHAR2(1),
bdateDATE,
relationshipVARCHAR(8),
CONSTRAINT pk_essn PRIMARY KEY (essn, dependent_name),
CONSTRAINT fk_essn FOREIGN KEY (essn) REFERENCES employee(ssn) ON DELETE
CASCADE);
INSERT INTO dependent VALUES ('333445555','Alice', 'F','05-APR-1976','Daughter');
INSERT INTO dependent VALUES ('333445555','Theodore', 'M','10-OCT-1973','Son');
INSERT INTO dependent VALUES ('333445555','Joy', 'F','03-MAY-1948','Spouse');
INSERT INTO dependent VALUES ('987654321','Abner', 'M','29-FEB-1932','Spouse');
INSERT INTO dependent VALUES ('123456789','John', 'M','01-JAN-1978','Son');
INSERT INTO dependent VALUES ('123456789','Alice', 'M','31-DEC-1978','Daughter');
INSERT INTO dependent VALUES ('123456789','Elizabeth', 'F','05-MAY-
1957','Spouse');
CREATE TABLE works_on
(essnCHAR(9) NOT NULL,
pnoNUMBER(2) NOT NULL,
hoursNUMBER(3,1),
CONSTRAINT pk_essn_pno PRIMARY KEY (essn, pno),
CONSTRAINT fk_pno FOREIGN KEY (pno) REFERENCES project(pnumber));
INSERT INTO works_on VALUES ('123456789',1,32.5);
INSERT INTO works_on VALUES ('123456789',2,7.5);
INSERT INTO works_on VALUES ('666884444',3,40.0);
INSERT INTO works_on VALUES ('453453453',1,20.0);
INSERT INTO works_on VALUES ('453453453',2,20.0);
INSERT INTO works_on VALUES ('333445555',2,10.0);
INSERT INTO works_on VALUES ('333445555',3,10.0);
INSERT INTO works_on VALUES ('333445555',10,10.0);
INSERT INTO works_on VALUES ('333445555',20,10.0);
INSERT INTO works_on VALUES ('999887777',30,30.0);
INSERT INTO works_on VALUES ('999887777',10,10.0);
INSERT INTO works_on VALUES ('987987987',10,35.0);
INSERT INTO works_on VALUES ('987987987',30,5.0);
INSERT INTO works_on VALUES ('987654321',30,20.0);
INSERT INTO works_on VALUES ('987654321',20,15.0);
INSERT INTO works_on VALUES ('888665555',20,null); 3. (20 points) In Oracle, tables,
procedures etc. are called objects. Each object has an owner. For example, if you create a table,
you are the owner of the table. Therefore, by default, your account is the owner of all the objects
created by you your account. Whenever you retrieve information from a table named as
tablename, Oracle will automatically append your account name as the prefix to the table name
ending with imiter. Then check table tablen exists or not. yes Oracle certainly allows you to
retrieve information from that table. For example, when I say select from employee: it actually is
equivalent to saying that select from sl4zhangs. employee: where my account name. therwise, if
you want to use a table owned by another account, you have to explicitly use owner account of
the table. For example, your account name is tom, but you want to retrieve information from a
table ti created by Kathy in the same database, you have to use select from Kathy. ti instead of
select from t1 a. List the result of the select from zhangsfallo5. employee: hint you will be shown
that ORA-00942: table or view does not exist, but the reason is that you have no privilege to do
so b. st the result of select from employee: if you have no employee table, create that table by
running the company script, then redo this query c. list the result of select from youraccount.
employee: note that you need to use your oracle account in the query. The result should be the
same as b) d. show script how to create a synonym for employee table, and then select all from
both the original table and the synonym just created by you to compare the result. The result
should be the same as b and c create synonym s for employee e. show script how to create a
public synonym for employee table. Hint, you will find that you have no privilege to create
public synonym. create public synonym ps for employee ERROR at line 1: ORA-00942: table or
view does not exist you need explicit GRANT select privilege grant select on ps to yourpartnerid
Solution
Output of select * from employee is below :
fname minit lname ssn bdate address sex salary superssn
Wolons E Aimee 888665555 10-NOV-1927 450 Stone, edsion, NJ F 55000
null
Ramirez Damian 987654321 20-JUN-1931 291 Berry, albany, NY M
43000 8886655550
Hall Nathan 333445555 09-DEC-1945 638 bruce, Oneonta, NY M 40000
888665555
Kelly David 999778888 19-JUL-1958 3321 central ave, New York, NY M
25000 987654321
Philip Dolensek 123456789 09-JAN-1955 731 clinton, Oneonta, NY M 30000
333445555
Reale Michael 666884444 15-SEP-1952 975 Fire Oak, Newark, NJ M 38000
333445555
Smith Jason 453453453 31-JUL-1962 5631 Rice, Harrison, NJ F 25000
333445555
Warren V Samantha 987987987 29-MAR-1959 908 Dallas, albany, NY F
25000 987654321
Please let me know what else is required.

More Related Content

Similar to Here is the company database for the problem--commen.pdf

Implementation Specifications
Implementation SpecificationsImplementation Specifications
Implementation Specifications
Unmon Mukherjee
 
SQL FILE FROM MOODLEUSE [master]GO Object Databa.pdf
SQL FILE FROM MOODLEUSE [master]GO Object Databa.pdfSQL FILE FROM MOODLEUSE [master]GO Object Databa.pdf
SQL FILE FROM MOODLEUSE [master]GO Object Databa.pdf
arrowit1
 
Use this script for the assignment.Please follow instructions as t.docx
Use this script for the assignment.Please follow instructions as t.docxUse this script for the assignment.Please follow instructions as t.docx
Use this script for the assignment.Please follow instructions as t.docx
garnerangelika
 
SQL.pptx
SQL.pptxSQL.pptx
SQL.pptx
SAIFKHAN41507
 
Plsql task answers
Plsql task answersPlsql task answers
Plsql task answers
Nawaz Sk
 
The resto txt Use for TM254 2021J TMA02 Question 6 .pdf
The resto txt     Use for TM254 2021J TMA02 Question 6 .pdfThe resto txt     Use for TM254 2021J TMA02 Question 6 .pdf
The resto txt Use for TM254 2021J TMA02 Question 6 .pdf
giriraj65
 

Similar to Here is the company database for the problem--commen.pdf (20)

Implementation Specifications
Implementation SpecificationsImplementation Specifications
Implementation Specifications
 
SQL FILE FROM MOODLEUSE [master]GO Object Databa.pdf
SQL FILE FROM MOODLEUSE [master]GO Object Databa.pdfSQL FILE FROM MOODLEUSE [master]GO Object Databa.pdf
SQL FILE FROM MOODLEUSE [master]GO Object Databa.pdf
 
Les09
Les09Les09
Les09
 
Sentencias básicas en oracle
Sentencias básicas en oracleSentencias básicas en oracle
Sentencias básicas en oracle
 
February0504 pm
February0504 pmFebruary0504 pm
February0504 pm
 
4sem dbms(1)
4sem dbms(1)4sem dbms(1)
4sem dbms(1)
 
Use this script for the assignment.Please follow instructions as t.docx
Use this script for the assignment.Please follow instructions as t.docxUse this script for the assignment.Please follow instructions as t.docx
Use this script for the assignment.Please follow instructions as t.docx
 
SQL.pptx
SQL.pptxSQL.pptx
SQL.pptx
 
Les09 Manipulating Data
Les09 Manipulating DataLes09 Manipulating Data
Les09 Manipulating Data
 
MySQL Indexing Crash Course
MySQL Indexing Crash CourseMySQL Indexing Crash Course
MySQL Indexing Crash Course
 
Plsql task answers
Plsql task answersPlsql task answers
Plsql task answers
 
Employ leave dtb
Employ leave dtbEmploy leave dtb
Employ leave dtb
 
The resto txt Use for TM254 2021J TMA02 Question 6 .pdf
The resto txt     Use for TM254 2021J TMA02 Question 6 .pdfThe resto txt     Use for TM254 2021J TMA02 Question 6 .pdf
The resto txt Use for TM254 2021J TMA02 Question 6 .pdf
 
NoSQL Data Modeling 101
NoSQL Data Modeling 101NoSQL Data Modeling 101
NoSQL Data Modeling 101
 
BD I - Aula 13 B - Agrupando Dados - Parte 04 - Exercicios Enunciado
BD I - Aula 13 B - Agrupando Dados  - Parte 04 - Exercicios EnunciadoBD I - Aula 13 B - Agrupando Dados  - Parte 04 - Exercicios Enunciado
BD I - Aula 13 B - Agrupando Dados - Parte 04 - Exercicios Enunciado
 
BD I - Aula 13 B - Agrupando dados - Parte 04 - Exercicios Enunciado
BD I - Aula 13 B - Agrupando dados  - Parte 04 - Exercicios EnunciadoBD I - Aula 13 B - Agrupando dados  - Parte 04 - Exercicios Enunciado
BD I - Aula 13 B - Agrupando dados - Parte 04 - Exercicios Enunciado
 
Mysql schema emp dept
Mysql schema emp deptMysql schema emp dept
Mysql schema emp dept
 
OpenWorld 2018 - Common Application Developer Disasters
OpenWorld 2018 - Common Application Developer DisastersOpenWorld 2018 - Common Application Developer Disasters
OpenWorld 2018 - Common Application Developer Disasters
 
4.3 Hibernate example.docx
4.3 Hibernate example.docx4.3 Hibernate example.docx
4.3 Hibernate example.docx
 
Cine
CineCine
Cine
 

More from fazilfootsteps

Why are the mass extinctions followed by a burst of speciation in .pdf
Why are the mass extinctions followed by a burst of speciation in .pdfWhy are the mass extinctions followed by a burst of speciation in .pdf
Why are the mass extinctions followed by a burst of speciation in .pdf
fazilfootsteps
 
Why is African American history important What challenges have Afri.pdf
Why is African American history important What challenges have Afri.pdfWhy is African American history important What challenges have Afri.pdf
Why is African American history important What challenges have Afri.pdf
fazilfootsteps
 
What does it mean to say that individuals as a group are net supplier.pdf
What does it mean to say that individuals as a group are net supplier.pdfWhat does it mean to say that individuals as a group are net supplier.pdf
What does it mean to say that individuals as a group are net supplier.pdf
fazilfootsteps
 
Thoughts on this Rule by the people is the main idea behind dem.pdf
Thoughts on this Rule by the people is the main idea behind dem.pdfThoughts on this Rule by the people is the main idea behind dem.pdf
Thoughts on this Rule by the people is the main idea behind dem.pdf
fazilfootsteps
 
potential benefits of sustainability strategySolutionpotential.pdf
potential benefits of sustainability strategySolutionpotential.pdfpotential benefits of sustainability strategySolutionpotential.pdf
potential benefits of sustainability strategySolutionpotential.pdf
fazilfootsteps
 
Please write a code in JAVA to do line editor..Your program will b.pdf
Please write a code in JAVA to do line editor..Your program will b.pdfPlease write a code in JAVA to do line editor..Your program will b.pdf
Please write a code in JAVA to do line editor..Your program will b.pdf
fazilfootsteps
 
Module 01 Discussion - Dominant CultureDefine the .pdf
Module 01 Discussion - Dominant CultureDefine the .pdfModule 01 Discussion - Dominant CultureDefine the .pdf
Module 01 Discussion - Dominant CultureDefine the .pdf
fazilfootsteps
 
List and explain the states of process in a specific operating syste.pdf
List and explain the states of process in a specific operating syste.pdfList and explain the states of process in a specific operating syste.pdf
List and explain the states of process in a specific operating syste.pdf
fazilfootsteps
 
Introduction to Philosophy 101 HomeworkSection 3 Deductive Argum.pdf
Introduction to Philosophy 101 HomeworkSection 3 Deductive Argum.pdfIntroduction to Philosophy 101 HomeworkSection 3 Deductive Argum.pdf
Introduction to Philosophy 101 HomeworkSection 3 Deductive Argum.pdf
fazilfootsteps
 
Indian Institute of Management Kashipur Executive Post Graduate Pro.pdf
Indian Institute of Management Kashipur Executive Post Graduate Pro.pdfIndian Institute of Management Kashipur Executive Post Graduate Pro.pdf
Indian Institute of Management Kashipur Executive Post Graduate Pro.pdf
fazilfootsteps
 
implemement the game.cpp by the header file given. And create main.c.pdf
implemement the game.cpp by the header file given. And create main.c.pdfimplemement the game.cpp by the header file given. And create main.c.pdf
implemement the game.cpp by the header file given. And create main.c.pdf
fazilfootsteps
 

More from fazilfootsteps (20)

Why are the mass extinctions followed by a burst of speciation in .pdf
Why are the mass extinctions followed by a burst of speciation in .pdfWhy are the mass extinctions followed by a burst of speciation in .pdf
Why are the mass extinctions followed by a burst of speciation in .pdf
 
Why is African American history important What challenges have Afri.pdf
Why is African American history important What challenges have Afri.pdfWhy is African American history important What challenges have Afri.pdf
Why is African American history important What challenges have Afri.pdf
 
Using the phase diagram of polydstyrene and DOP below, would you ex.pdf
Using the phase diagram of polydstyrene and DOP below, would you ex.pdfUsing the phase diagram of polydstyrene and DOP below, would you ex.pdf
Using the phase diagram of polydstyrene and DOP below, would you ex.pdf
 
What does it mean to say that individuals as a group are net supplier.pdf
What does it mean to say that individuals as a group are net supplier.pdfWhat does it mean to say that individuals as a group are net supplier.pdf
What does it mean to say that individuals as a group are net supplier.pdf
 
True or False Statement The DNS namespace is hierarchical. Protocols.pdf
True or False Statement The DNS namespace is hierarchical. Protocols.pdfTrue or False Statement The DNS namespace is hierarchical. Protocols.pdf
True or False Statement The DNS namespace is hierarchical. Protocols.pdf
 
Thoughts on this Rule by the people is the main idea behind dem.pdf
Thoughts on this Rule by the people is the main idea behind dem.pdfThoughts on this Rule by the people is the main idea behind dem.pdf
Thoughts on this Rule by the people is the main idea behind dem.pdf
 
The symmetry properties of the plane figure formed by the four point.pdf
The symmetry properties of the plane figure formed by the four point.pdfThe symmetry properties of the plane figure formed by the four point.pdf
The symmetry properties of the plane figure formed by the four point.pdf
 
QUESTION 12 (Learning Outcome 3) Which of the following flawed uses o.pdf
QUESTION 12 (Learning Outcome 3) Which of the following flawed uses o.pdfQUESTION 12 (Learning Outcome 3) Which of the following flawed uses o.pdf
QUESTION 12 (Learning Outcome 3) Which of the following flawed uses o.pdf
 
Robbinsdale Hospital is one of two hospitals among the six facilitie.pdf
Robbinsdale Hospital is one of two hospitals among the six facilitie.pdfRobbinsdale Hospital is one of two hospitals among the six facilitie.pdf
Robbinsdale Hospital is one of two hospitals among the six facilitie.pdf
 
Research excise taxes in other states besides North Carolina. Report.pdf
Research excise taxes in other states besides North Carolina. Report.pdfResearch excise taxes in other states besides North Carolina. Report.pdf
Research excise taxes in other states besides North Carolina. Report.pdf
 
Prove that E X is not connected if and only if there exist open sets.pdf
Prove that E  X is not connected if and only if there exist open sets.pdfProve that E  X is not connected if and only if there exist open sets.pdf
Prove that E X is not connected if and only if there exist open sets.pdf
 
potential benefits of sustainability strategySolutionpotential.pdf
potential benefits of sustainability strategySolutionpotential.pdfpotential benefits of sustainability strategySolutionpotential.pdf
potential benefits of sustainability strategySolutionpotential.pdf
 
Please write a code in JAVA to do line editor..Your program will b.pdf
Please write a code in JAVA to do line editor..Your program will b.pdfPlease write a code in JAVA to do line editor..Your program will b.pdf
Please write a code in JAVA to do line editor..Your program will b.pdf
 
Nessus is a network security tool- write a pragraph describe itsto.pdf
Nessus is a network security tool- write a pragraph describe itsto.pdfNessus is a network security tool- write a pragraph describe itsto.pdf
Nessus is a network security tool- write a pragraph describe itsto.pdf
 
Module 01 Discussion - Dominant CultureDefine the .pdf
Module 01 Discussion - Dominant CultureDefine the .pdfModule 01 Discussion - Dominant CultureDefine the .pdf
Module 01 Discussion - Dominant CultureDefine the .pdf
 
List and explain the states of process in a specific operating syste.pdf
List and explain the states of process in a specific operating syste.pdfList and explain the states of process in a specific operating syste.pdf
List and explain the states of process in a specific operating syste.pdf
 
Most integer types are directly supported by hardware, but some are n.pdf
Most integer types are directly supported by hardware, but some are n.pdfMost integer types are directly supported by hardware, but some are n.pdf
Most integer types are directly supported by hardware, but some are n.pdf
 
Introduction to Philosophy 101 HomeworkSection 3 Deductive Argum.pdf
Introduction to Philosophy 101 HomeworkSection 3 Deductive Argum.pdfIntroduction to Philosophy 101 HomeworkSection 3 Deductive Argum.pdf
Introduction to Philosophy 101 HomeworkSection 3 Deductive Argum.pdf
 
Indian Institute of Management Kashipur Executive Post Graduate Pro.pdf
Indian Institute of Management Kashipur Executive Post Graduate Pro.pdfIndian Institute of Management Kashipur Executive Post Graduate Pro.pdf
Indian Institute of Management Kashipur Executive Post Graduate Pro.pdf
 
implemement the game.cpp by the header file given. And create main.c.pdf
implemement the game.cpp by the header file given. And create main.c.pdfimplemement the game.cpp by the header file given. And create main.c.pdf
implemement the game.cpp by the header file given. And create main.c.pdf
 

Recently uploaded

QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
httgc7rh9c
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MysoreMuleSoftMeetup
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
EADTU
 
Orientation Canvas Course Presentation.pdf
Orientation Canvas Course Presentation.pdfOrientation Canvas Course Presentation.pdf
Orientation Canvas Course Presentation.pdf
Elizabeth Walsh
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 

Recently uploaded (20)

Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
Ernest Hemingway's For Whom the Bell Tolls
Ernest Hemingway's For Whom the Bell TollsErnest Hemingway's For Whom the Bell Tolls
Ernest Hemingway's For Whom the Bell Tolls
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Orientation Canvas Course Presentation.pdf
Orientation Canvas Course Presentation.pdfOrientation Canvas Course Presentation.pdf
Orientation Canvas Course Presentation.pdf
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 

Here is the company database for the problem--commen.pdf

  • 1. Here is the company database for the problem --comments can be added DROP TABLE works_on; DROP TABLE dependent; DROP TABLE project; DROP TABLE dept_location; ALTER TABLE department DROP CONSTRAINT fk_mgrssn CASCADE; ALTER TABLE employee DROP CONSTRAINT fk_dno CASCADE; DROP TABLE department; DROP TABLE employee; CREATE TABLE employee (fnameVARCHAR2(12), minitCHAR(1), lnameVARCHAR2(12), ssnCHAR(9) NOT NULL, bdateDATE, addressVARCHAR2(40), sexCHAR(1), salaryNUMBER(7) NOT NULL, superssnCHAR(9) references employee(ssn), /*superssnCHAR(9),*/ /*either way, but need to know superssn is from ssn*/ CONSTRAINT pk_ssn PRIMARY KEY (SSN)); ALTER TABLE employee ADD (dno NUMBER(2) NOT NULL);
  • 2. INSERT INTO employee VALUES ('Wolons', 'E', 'Aimee', '888665555', '10-NOV-1927', '450 Stone, edsion, NJ', 'F', 55000, null,1); INSERT INTO employee VALUES ('Ramirez', '', 'Damian', '987654321', '20-JUN-1931', '291 Berry, albany, NY', 'M', 43000, '888665555',4); INSERT INTO employee VALUES ('Hall', '', 'Nathan', '333445555', '09-DEC-1945', '638 bruce, Oneonta, NY', 'M', 40000, '888665555',5); INSERT INTO employee VALUES ('Kelly', '', 'David', '999778888', '19-JUL-1958', '3321 central ave, New York, NY', 'M', 25000, '987654321',4); INSERT INTO employee VALUES ('Philip', '', 'Dolensek', '123456789', '09-JAN-1955', '731 clinton, Oneonta, NY', 'M', 30000, '333445555',5); INSERT INTO employee VALUES ('Reale', '', 'Michael', '666884444', '15-SEP-1952', '975 Fire Oak, Newark, NJ', 'M', 38000, '333445555',5); INSERT INTO employee VALUES ('Smith', '', 'Jason', '453453453', '31-JUL-1962', '5631 Rice, Harrison, NJ', 'F', 25000, '333445555',5); INSERT INTO employee VALUES ('Warren', 'V', 'Samantha', '987987987', '29-MAR-1959', '908 Dallas, albany, NY', 'F', 25000, '987654321',4); select e.fname, e.lname, s.fname, s.lname from employee e, employee s where e.superssn=s.ssn;
  • 3. CREATE TABLE department (dnameVARCHAR2(20) NOT NULL, dnumberNUMBER(2) NOT NULL, mgrssnCHAR(9) NOT NULL, mgrstartdateDATE, CONSTRAINT pk_dnumber PRIMARY KEY (DNUMBER), CONSTRAINT fk_mgrssn FOREIGN KEY (mgrssn) REFERENCES employee (ssn)); INSERT INTO department VALUES ('Research',5 , '333445555', '22-MAY-1978'); INSERT INTO department VALUES ('Administration',4 , '987654321', '01-JAN-1985'); INSERT INTO department VALUES ('Computing Service', 1, '888665555', '19-JUN-1971'); ALTER TABLE employee ADD (CONSTRAINT fk_dno FOREIGN KEY (dno) REFERENCES department(dnumber)); CREATE TABLE dept_location (dnumberNUMBER(2) , dlocationVARCHAR2(20), CONSTRAINT pk_num_loc PRIMARY key (dnumber, dlocation), CONSTRAINT fk_dnumber FOREIGN KEY (dnumber) REFERENCES department(dnumber));
  • 4. INSERT INTO dept_location VALUES (1,'Fitzelle'); INSERT INTO dept_location VALUES (4,'Hunt union'); INSERT INTO dept_location VALUES (5,'Natza'); INSERT INTO dept_location VALUES (5,'Hunt union'); INSERT INTO dept_location VALUES (5,'Fitzelle'); CREATE TABLE project (pnameVARCHAR2(15), pnumberNUMBER(2) NOT NULL, plocationVARCHAR2(15) , dnumNUMBER(2), CONSTRAINT pk_pnumber PRIMARY KEY (PNUMBER), CONSTRAINT fk_dnum FOREIGN KEY (dnum) REFERENCES department(dnumber)); INSERT INTO project VALUES ('ProductX', 1,'library',5); INSERT INTO project VALUES ('ProductY', 2,'Fitzelle hall',5); INSERT INTO project VALUES ('ProductZ', 3,'Library',5); INSERT INTO project VALUES ('Computerization', 10,'IRC',4); INSERT INTO project VALUES ('Reorganization', 20,'IRC',1); INSERT INTO project VALUES ('Newbenefits', 30,'Hunt Union',4); CREATE TABLE dependent (essnCHAR(9) NOT NULL, dependent_name VARCHAR(9) NOT NULL, sexVARCHAR2(1), bdateDATE, relationshipVARCHAR(8),
  • 5. CONSTRAINT pk_essn PRIMARY KEY (essn, dependent_name), CONSTRAINT fk_essn FOREIGN KEY (essn) REFERENCES employee(ssn) ON DELETE CASCADE); INSERT INTO dependent VALUES ('333445555','Alice', 'F','05-APR-1976','Daughter'); INSERT INTO dependent VALUES ('333445555','Theodore', 'M','10-OCT-1973','Son'); INSERT INTO dependent VALUES ('333445555','Joy', 'F','03-MAY-1948','Spouse'); INSERT INTO dependent VALUES ('987654321','Abner', 'M','29-FEB-1932','Spouse'); INSERT INTO dependent VALUES ('123456789','John', 'M','01-JAN-1978','Son'); INSERT INTO dependent VALUES ('123456789','Alice', 'M','31-DEC-1978','Daughter'); INSERT INTO dependent VALUES ('123456789','Elizabeth', 'F','05-MAY- 1957','Spouse'); CREATE TABLE works_on (essnCHAR(9) NOT NULL, pnoNUMBER(2) NOT NULL, hoursNUMBER(3,1), CONSTRAINT pk_essn_pno PRIMARY KEY (essn, pno), CONSTRAINT fk_pno FOREIGN KEY (pno) REFERENCES project(pnumber)); INSERT INTO works_on VALUES ('123456789',1,32.5); INSERT INTO works_on VALUES ('123456789',2,7.5); INSERT INTO works_on VALUES ('666884444',3,40.0); INSERT INTO works_on VALUES ('453453453',1,20.0); INSERT INTO works_on VALUES ('453453453',2,20.0); INSERT INTO works_on VALUES ('333445555',2,10.0); INSERT INTO works_on VALUES ('333445555',3,10.0);
  • 6. INSERT INTO works_on VALUES ('333445555',10,10.0); INSERT INTO works_on VALUES ('333445555',20,10.0); INSERT INTO works_on VALUES ('999887777',30,30.0); INSERT INTO works_on VALUES ('999887777',10,10.0); INSERT INTO works_on VALUES ('987987987',10,35.0); INSERT INTO works_on VALUES ('987987987',30,5.0); INSERT INTO works_on VALUES ('987654321',30,20.0); INSERT INTO works_on VALUES ('987654321',20,15.0); INSERT INTO works_on VALUES ('888665555',20,null); --comments can be added DROP TABLE works_on; DROP TABLE dependent; DROP TABLE project; DROP TABLE dept_location; ALTER TABLE department DROP CONSTRAINT fk_mgrssn CASCADE; ALTER TABLE employee DROP CONSTRAINT fk_dno CASCADE; DROP TABLE department; DROP TABLE employee; CREATE TABLE employee (fnameVARCHAR2(12), minitCHAR(1), lnameVARCHAR2(12), ssnCHAR(9) NOT NULL, bdateDATE, addressVARCHAR2(40), sexCHAR(1), salaryNUMBER(7) NOT NULL, superssnCHAR(9) references employee(ssn), /*superssnCHAR(9),*/ /*either way, but need to know superssn is from ssn*/ CONSTRAINT pk_ssn PRIMARY KEY (SSN)); ALTER TABLE employee ADD (dno NUMBER(2) NOT NULL);
  • 7. INSERT INTO employee VALUES ('Wolons', 'E', 'Aimee', '888665555', '10-NOV-1927', '450 Stone, edsion, NJ', 'F', 55000, null,1); INSERT INTO employee VALUES ('Ramirez', '', 'Damian', '987654321', '20-JUN-1931', '291 Berry, albany, NY', 'M', 43000, '888665555',4); INSERT INTO employee VALUES ('Hall', '', 'Nathan', '333445555', '09-DEC-1945', '638 bruce, Oneonta, NY', 'M', 40000, '888665555',5); INSERT INTO employee VALUES ('Kelly', '', 'David', '999778888', '19-JUL-1958', '3321 central ave, New York, NY', 'M', 25000, '987654321',4); INSERT INTO employee VALUES ('Philip', '', 'Dolensek', '123456789', '09-JAN-1955', '731 clinton, Oneonta, NY', 'M', 30000, '333445555',5); INSERT INTO employee VALUES ('Reale', '', 'Michael', '666884444', '15-SEP-1952', '975 Fire Oak, Newark, NJ', 'M', 38000, '333445555',5); INSERT INTO employee VALUES ('Smith', '', 'Jason', '453453453', '31-JUL-1962', '5631 Rice, Harrison, NJ', 'F', 25000, '333445555',5); INSERT INTO employee VALUES ('Warren', 'V', 'Samantha', '987987987', '29-MAR-1959', '908 Dallas, albany, NY', 'F', 25000, '987654321',4); select e.fname, e.lname, s.fname, s.lname from employee e, employee s where e.superssn=s.ssn;
  • 8. CREATE TABLE department (dnameVARCHAR2(20) NOT NULL, dnumberNUMBER(2) NOT NULL, mgrssnCHAR(9) NOT NULL, mgrstartdateDATE, CONSTRAINT pk_dnumber PRIMARY KEY (DNUMBER), CONSTRAINT fk_mgrssn FOREIGN KEY (mgrssn) REFERENCES employee (ssn)); INSERT INTO department VALUES ('Research',5 , '333445555', '22-MAY-1978'); INSERT INTO department VALUES ('Administration',4 , '987654321', '01-JAN-1985'); INSERT INTO department VALUES ('Computing Service', 1, '888665555', '19-JUN-1971'); ALTER TABLE employee ADD (CONSTRAINT fk_dno FOREIGN KEY (dno) REFERENCES department(dnumber)); CREATE TABLE dept_location (dnumberNUMBER(2) , dlocationVARCHAR2(20), CONSTRAINT pk_num_loc PRIMARY key (dnumber, dlocation), CONSTRAINT fk_dnumber FOREIGN KEY (dnumber) REFERENCES department(dnumber));
  • 9. INSERT INTO dept_location VALUES (1,'Fitzelle'); INSERT INTO dept_location VALUES (4,'Hunt union'); INSERT INTO dept_location VALUES (5,'Natza'); INSERT INTO dept_location VALUES (5,'Hunt union'); INSERT INTO dept_location VALUES (5,'Fitzelle'); CREATE TABLE project (pnameVARCHAR2(15), pnumberNUMBER(2) NOT NULL, plocationVARCHAR2(15) , dnumNUMBER(2), CONSTRAINT pk_pnumber PRIMARY KEY (PNUMBER), CONSTRAINT fk_dnum FOREIGN KEY (dnum) REFERENCES department(dnumber)); INSERT INTO project VALUES ('ProductX', 1,'library',5); INSERT INTO project VALUES ('ProductY', 2,'Fitzelle hall',5); INSERT INTO project VALUES ('ProductZ', 3,'Library',5); INSERT INTO project VALUES ('Computerization', 10,'IRC',4); INSERT INTO project VALUES ('Reorganization', 20,'IRC',1); INSERT INTO project VALUES ('Newbenefits', 30,'Hunt Union',4); CREATE TABLE dependent (essnCHAR(9) NOT NULL, dependent_name VARCHAR(9) NOT NULL, sexVARCHAR2(1), bdateDATE, relationshipVARCHAR(8),
  • 10. CONSTRAINT pk_essn PRIMARY KEY (essn, dependent_name), CONSTRAINT fk_essn FOREIGN KEY (essn) REFERENCES employee(ssn) ON DELETE CASCADE); INSERT INTO dependent VALUES ('333445555','Alice', 'F','05-APR-1976','Daughter'); INSERT INTO dependent VALUES ('333445555','Theodore', 'M','10-OCT-1973','Son'); INSERT INTO dependent VALUES ('333445555','Joy', 'F','03-MAY-1948','Spouse'); INSERT INTO dependent VALUES ('987654321','Abner', 'M','29-FEB-1932','Spouse'); INSERT INTO dependent VALUES ('123456789','John', 'M','01-JAN-1978','Son'); INSERT INTO dependent VALUES ('123456789','Alice', 'M','31-DEC-1978','Daughter'); INSERT INTO dependent VALUES ('123456789','Elizabeth', 'F','05-MAY- 1957','Spouse'); CREATE TABLE works_on (essnCHAR(9) NOT NULL, pnoNUMBER(2) NOT NULL, hoursNUMBER(3,1), CONSTRAINT pk_essn_pno PRIMARY KEY (essn, pno), CONSTRAINT fk_pno FOREIGN KEY (pno) REFERENCES project(pnumber)); INSERT INTO works_on VALUES ('123456789',1,32.5); INSERT INTO works_on VALUES ('123456789',2,7.5); INSERT INTO works_on VALUES ('666884444',3,40.0); INSERT INTO works_on VALUES ('453453453',1,20.0); INSERT INTO works_on VALUES ('453453453',2,20.0); INSERT INTO works_on VALUES ('333445555',2,10.0); INSERT INTO works_on VALUES ('333445555',3,10.0);
  • 11. INSERT INTO works_on VALUES ('333445555',10,10.0); INSERT INTO works_on VALUES ('333445555',20,10.0); INSERT INTO works_on VALUES ('999887777',30,30.0); INSERT INTO works_on VALUES ('999887777',10,10.0); INSERT INTO works_on VALUES ('987987987',10,35.0); INSERT INTO works_on VALUES ('987987987',30,5.0); INSERT INTO works_on VALUES ('987654321',30,20.0); INSERT INTO works_on VALUES ('987654321',20,15.0); INSERT INTO works_on VALUES ('888665555',20,null); 3. (20 points) In Oracle, tables, procedures etc. are called objects. Each object has an owner. For example, if you create a table, you are the owner of the table. Therefore, by default, your account is the owner of all the objects created by you your account. Whenever you retrieve information from a table named as tablename, Oracle will automatically append your account name as the prefix to the table name ending with imiter. Then check table tablen exists or not. yes Oracle certainly allows you to retrieve information from that table. For example, when I say select from employee: it actually is equivalent to saying that select from sl4zhangs. employee: where my account name. therwise, if you want to use a table owned by another account, you have to explicitly use owner account of the table. For example, your account name is tom, but you want to retrieve information from a table ti created by Kathy in the same database, you have to use select from Kathy. ti instead of select from t1 a. List the result of the select from zhangsfallo5. employee: hint you will be shown that ORA-00942: table or view does not exist, but the reason is that you have no privilege to do so b. st the result of select from employee: if you have no employee table, create that table by running the company script, then redo this query c. list the result of select from youraccount. employee: note that you need to use your oracle account in the query. The result should be the same as b) d. show script how to create a synonym for employee table, and then select all from both the original table and the synonym just created by you to compare the result. The result should be the same as b and c create synonym s for employee e. show script how to create a public synonym for employee table. Hint, you will find that you have no privilege to create public synonym. create public synonym ps for employee ERROR at line 1: ORA-00942: table or view does not exist you need explicit GRANT select privilege grant select on ps to yourpartnerid Solution Output of select * from employee is below : fname minit lname ssn bdate address sex salary superssn
  • 12. Wolons E Aimee 888665555 10-NOV-1927 450 Stone, edsion, NJ F 55000 null Ramirez Damian 987654321 20-JUN-1931 291 Berry, albany, NY M 43000 8886655550 Hall Nathan 333445555 09-DEC-1945 638 bruce, Oneonta, NY M 40000 888665555 Kelly David 999778888 19-JUL-1958 3321 central ave, New York, NY M 25000 987654321 Philip Dolensek 123456789 09-JAN-1955 731 clinton, Oneonta, NY M 30000 333445555 Reale Michael 666884444 15-SEP-1952 975 Fire Oak, Newark, NJ M 38000 333445555 Smith Jason 453453453 31-JUL-1962 5631 Rice, Harrison, NJ F 25000 333445555 Warren V Samantha 987987987 29-MAR-1959 908 Dallas, albany, NY F 25000 987654321 Please let me know what else is required.