SlideShare a Scribd company logo
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

Oracle trigger
Oracle triggerOracle trigger
Oracle trigger
nasrul28
 
DOODB_LAB.pptx
DOODB_LAB.pptxDOODB_LAB.pptx
DOODB_LAB.pptx
FilestreamFilestream
 
Implementation Specifications
Implementation SpecificationsImplementation Specifications
Implementation SpecificationsUnmon Mukherjee
 
Chapter08
Chapter08Chapter08
Chapter08
sasa_eldoby
 
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
 
Sentencias básicas en oracle
Sentencias básicas en oracleSentencias básicas en oracle
Sentencias básicas en oracle
Nelson Salinas
 
Sql queries - Basics
Sql queries - BasicsSql queries - Basics
Sql queries - Basics
Purvik Rana
 
Basic Sql Handouts
Basic Sql HandoutsBasic Sql Handouts
Basic Sql Handoutsjhe04
 
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
 
Ppt INFORMATIVE PRACTICES for class 11th chapter 14
Ppt INFORMATIVE PRACTICES for class 11th chapter 14Ppt INFORMATIVE PRACTICES for class 11th chapter 14
Ppt INFORMATIVE PRACTICES for class 11th chapter 14
prashant0000
 
DBMS ASSIGNMENT questions list for graduation .pdf
DBMS ASSIGNMENT questions list for graduation .pdfDBMS ASSIGNMENT questions list for graduation .pdf
DBMS ASSIGNMENT questions list for graduation .pdf
StudyWithBarkha
 
Dbms assignment 3(a) (1)
Dbms assignment 3(a) (1)Dbms assignment 3(a) (1)
Dbms assignment 3(a) (1)
SwapnadipSahoo1
 
MySQL Indexing Crash Course
MySQL Indexing Crash CourseMySQL Indexing Crash Course
MySQL Indexing Crash Course
Aaron Silverman
 
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
PgDay.Seoul
 
Plsql task answers
Plsql task answersPlsql task answers
Plsql task answersNawaz Sk
 

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

Oracle trigger
Oracle triggerOracle trigger
Oracle trigger
 
DOODB_LAB.pptx
DOODB_LAB.pptxDOODB_LAB.pptx
DOODB_LAB.pptx
 
Implementation Specifications
Implementation SpecificationsImplementation Specifications
Implementation Specifications
 
Chapter08
Chapter08Chapter08
Chapter08
 
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
 
Sql queries - Basics
Sql queries - BasicsSql queries - Basics
Sql queries - Basics
 
4sem dbms(1)
4sem dbms(1)4sem dbms(1)
4sem dbms(1)
 
Basic Sql Handouts
Basic Sql HandoutsBasic Sql Handouts
Basic Sql Handouts
 
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
 
Ppt INFORMATIVE PRACTICES for class 11th chapter 14
Ppt INFORMATIVE PRACTICES for class 11th chapter 14Ppt INFORMATIVE PRACTICES for class 11th chapter 14
Ppt INFORMATIVE PRACTICES for class 11th chapter 14
 
Les09 Manipulating Data
Les09 Manipulating DataLes09 Manipulating Data
Les09 Manipulating Data
 
DBMS ASSIGNMENT questions list for graduation .pdf
DBMS ASSIGNMENT questions list for graduation .pdfDBMS ASSIGNMENT questions list for graduation .pdf
DBMS ASSIGNMENT questions list for graduation .pdf
 
Dbms assignment 3(a) (1)
Dbms assignment 3(a) (1)Dbms assignment 3(a) (1)
Dbms assignment 3(a) (1)
 
MySQL Indexing Crash Course
MySQL Indexing Crash CourseMySQL Indexing Crash Course
MySQL Indexing Crash Course
 
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
 
Plsql task answers
Plsql task answersPlsql task answers
Plsql task answers
 

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
 
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
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
 
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
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
 
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
fazilfootsteps
 
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
fazilfootsteps
 
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
fazilfootsteps
 
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
fazilfootsteps
 
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
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
 
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
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
 
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
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

The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 

Recently uploaded (20)

The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.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.