SlideShare a Scribd company logo
1 of 17
Download to read offline
Here is the company database
--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);
--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); 2. (30 points) Here are a couple
subquery problems regarding to the tables in the company database. you might be tempted to use
flat queries to answer some of them, you have to use (if they are not as non-flat query problems)
in this question in order to get better understanding to sub queries. (Hints: sample script file and
textbook.) To find out the script, visit homework 3 for the script. b) find out the lowest salary for
each department (flat query) hint: use group by c) Find out the names of those people whose
salary is the lowest salary in each department. (A little bit more challenging, use nested query or
called subquery) d) find out ssns of those people who work on two projects. (nested query) e)
Find out who works on two projects, i. e, to find out names of those people write a select
command to calculate what the salary would be if every body get a 7% raise. (fiat query) g)
Write an update command to give all employees in the I Research department a seven percent
raise in salary. h Retrieve the names of all employees who have two or more dependents
Solution
1. select min(salary) from employee;
2. select min(salary) from employee,department where mgrssn =ssn group by dnumber;
3.select min(salary),fname from employee,department where mgrssn = ssn group by dnumber
,fname;
4 .select ssn ,count(pno) from employee e, works_on where essn= ssn group by ssn having
count(pno)>2;
5. select fname ,count(pno) from employee e, works_on where essn= ssn group by ssn,fname
having count(pno)>2;
6. select salary*1.07 from employee;
7 . update employee set salary =salary1.07 where ssn in ( select mgrssn from department where
dname ='Research');
8. select fname from employee ,dependent where ssn=essn group by ssn having count(1)>2

More Related Content

Similar to Here is the company database--comments can be addedD.pdf

Dbms quiz 01 solution
Dbms quiz 01 solutionDbms quiz 01 solution
Dbms quiz 01 solutionmushiabro
 
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.pdfarrowit1
 
Sentencias básicas en oracle
Sentencias básicas en oracleSentencias básicas en oracle
Sentencias básicas en oracleNelson Salinas
 
Implementation Specifications
Implementation SpecificationsImplementation Specifications
Implementation SpecificationsUnmon Mukherjee
 
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.docxgarnerangelika
 
Plsql task answers
Plsql task answersPlsql task answers
Plsql task answersNawaz Sk
 
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 14prashant0000
 
[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 OptimizationPgDay.Seoul
 
Sql queries - Basics
Sql queries - BasicsSql queries - Basics
Sql queries - BasicsPurvik Rana
 
T sql denali code Day of .Net
T sql denali code Day of .NetT sql denali code Day of .Net
T sql denali code Day of .NetKathiK58
 
MySQL Indexing Crash Course
MySQL Indexing Crash CourseMySQL Indexing Crash Course
MySQL Indexing Crash CourseAaron Silverman
 
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 .pdfgiriraj65
 

Similar to Here is the company database--comments can be addedD.pdf (20)

DOODB_LAB.pptx
DOODB_LAB.pptxDOODB_LAB.pptx
DOODB_LAB.pptx
 
Dbms quiz 01 solution
Dbms quiz 01 solutionDbms quiz 01 solution
Dbms quiz 01 solution
 
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
 
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)
 
Chapter08
Chapter08Chapter08
Chapter08
 
Implementation Specifications
Implementation SpecificationsImplementation Specifications
Implementation Specifications
 
Basic Sql Handouts
Basic Sql HandoutsBasic Sql Handouts
Basic Sql Handouts
 
Les09
Les09Les09
Les09
 
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
 
Plsql task answers
Plsql task answersPlsql task answers
Plsql task answers
 
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
 
[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
 
Les09 Manipulating Data
Les09 Manipulating DataLes09 Manipulating Data
Les09 Manipulating Data
 
Sql queries - Basics
Sql queries - BasicsSql queries - Basics
Sql queries - Basics
 
T sql denali code Day of .Net
T sql denali code Day of .NetT sql denali code Day of .Net
T sql denali code Day of .Net
 
MySQL Indexing Crash Course
MySQL Indexing Crash CourseMySQL Indexing Crash Course
MySQL Indexing Crash Course
 
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
 

More from fckindswear

Nessus is a network security toolIn a pragraph describe how it is .pdf
Nessus is a network security toolIn a pragraph describe how it is .pdfNessus is a network security toolIn a pragraph describe how it is .pdf
Nessus is a network security toolIn a pragraph describe how it is .pdffckindswear
 
Luthans and Doh (2012) discuss two major forms of communication flow.pdf
Luthans and Doh (2012) discuss two major forms of communication flow.pdfLuthans and Doh (2012) discuss two major forms of communication flow.pdf
Luthans and Doh (2012) discuss two major forms of communication flow.pdffckindswear
 
Is the value of the Manufacturing Plant considered a long term or a .pdf
Is the value of the Manufacturing Plant considered a long term or a .pdfIs the value of the Manufacturing Plant considered a long term or a .pdf
Is the value of the Manufacturing Plant considered a long term or a .pdffckindswear
 
Indicate whether you agree or disagree with the following statements.pdf
Indicate whether you agree or disagree with the following statements.pdfIndicate whether you agree or disagree with the following statements.pdf
Indicate whether you agree or disagree with the following statements.pdffckindswear
 
Identify any relative maxima or minima and intervals on which the fun.pdf
Identify any relative maxima or minima and intervals on which the fun.pdfIdentify any relative maxima or minima and intervals on which the fun.pdf
Identify any relative maxima or minima and intervals on which the fun.pdffckindswear
 
How exposure to an argument through mass media may have influenced o.pdf
How exposure to an argument through mass media may have influenced o.pdfHow exposure to an argument through mass media may have influenced o.pdf
How exposure to an argument through mass media may have influenced o.pdffckindswear
 
Find the IPv6 prefix of the address 20010fc3ca540 a0 10 if the .pdf
Find the IPv6 prefix of the address 20010fc3ca540 a0 10 if the .pdfFind the IPv6 prefix of the address 20010fc3ca540 a0 10 if the .pdf
Find the IPv6 prefix of the address 20010fc3ca540 a0 10 if the .pdffckindswear
 
Explain the kinds of information that must be maintained in fixed as.pdf
Explain the kinds of information that must be maintained in fixed as.pdfExplain the kinds of information that must be maintained in fixed as.pdf
Explain the kinds of information that must be maintained in fixed as.pdffckindswear
 
Dr. P has a culture of stem cells and she wants them to specialize i.pdf
Dr. P has a culture of stem cells and she wants them to specialize i.pdfDr. P has a culture of stem cells and she wants them to specialize i.pdf
Dr. P has a culture of stem cells and she wants them to specialize i.pdffckindswear
 
Describe two ecological roles of fungi. Related concepts decomposer.pdf
Describe two ecological roles of fungi. Related concepts decomposer.pdfDescribe two ecological roles of fungi. Related concepts decomposer.pdf
Describe two ecological roles of fungi. Related concepts decomposer.pdffckindswear
 
Differential equations using phase plane analysis. Task 1 (Romeo .pdf
Differential equations using phase plane analysis. Task 1 (Romeo .pdfDifferential equations using phase plane analysis. Task 1 (Romeo .pdf
Differential equations using phase plane analysis. Task 1 (Romeo .pdffckindswear
 
Develop a stack in c with dynamic memory allocation. Use the followi.pdf
Develop a stack in c with dynamic memory allocation. Use the followi.pdfDevelop a stack in c with dynamic memory allocation. Use the followi.pdf
Develop a stack in c with dynamic memory allocation. Use the followi.pdffckindswear
 
Define a struct type that represents a smartphone. The struct should.pdf
Define a struct type that represents a smartphone. The struct should.pdfDefine a struct type that represents a smartphone. The struct should.pdf
Define a struct type that represents a smartphone. The struct should.pdffckindswear
 
Changes in the economy have determined that for the EZ shipping comp.pdf
Changes in the economy have determined that for the EZ shipping comp.pdfChanges in the economy have determined that for the EZ shipping comp.pdf
Changes in the economy have determined that for the EZ shipping comp.pdffckindswear
 
Broadly speaking, the economy consists of households, firms, governm.pdf
Broadly speaking, the economy consists of households, firms, governm.pdfBroadly speaking, the economy consists of households, firms, governm.pdf
Broadly speaking, the economy consists of households, firms, governm.pdffckindswear
 
A committee consists of 13 Republicans and 16 Democrats. How many dif.pdf
A committee consists of 13 Republicans and 16 Democrats. How many dif.pdfA committee consists of 13 Republicans and 16 Democrats. How many dif.pdf
A committee consists of 13 Republicans and 16 Democrats. How many dif.pdffckindswear
 
2. July 01 Record the dividend received from the foreign subsidiary..pdf
2. July 01 Record the dividend received from the foreign subsidiary..pdf2. July 01 Record the dividend received from the foreign subsidiary..pdf
2. July 01 Record the dividend received from the foreign subsidiary..pdffckindswear
 
You have isolated a new virus, determined it has a lipid envelope,.pdf
You have isolated a new virus, determined it has a lipid envelope,.pdfYou have isolated a new virus, determined it has a lipid envelope,.pdf
You have isolated a new virus, determined it has a lipid envelope,.pdffckindswear
 
Write the Java source code necessary to build a solution for the pro.pdf
Write the Java source code necessary to build a solution for the pro.pdfWrite the Java source code necessary to build a solution for the pro.pdf
Write the Java source code necessary to build a solution for the pro.pdffckindswear
 
Why is agrobacterium tumfaciens useful to Kant biologists Describ.pdf
Why is agrobacterium tumfaciens useful to Kant biologists Describ.pdfWhy is agrobacterium tumfaciens useful to Kant biologists Describ.pdf
Why is agrobacterium tumfaciens useful to Kant biologists Describ.pdffckindswear
 

More from fckindswear (20)

Nessus is a network security toolIn a pragraph describe how it is .pdf
Nessus is a network security toolIn a pragraph describe how it is .pdfNessus is a network security toolIn a pragraph describe how it is .pdf
Nessus is a network security toolIn a pragraph describe how it is .pdf
 
Luthans and Doh (2012) discuss two major forms of communication flow.pdf
Luthans and Doh (2012) discuss two major forms of communication flow.pdfLuthans and Doh (2012) discuss two major forms of communication flow.pdf
Luthans and Doh (2012) discuss two major forms of communication flow.pdf
 
Is the value of the Manufacturing Plant considered a long term or a .pdf
Is the value of the Manufacturing Plant considered a long term or a .pdfIs the value of the Manufacturing Plant considered a long term or a .pdf
Is the value of the Manufacturing Plant considered a long term or a .pdf
 
Indicate whether you agree or disagree with the following statements.pdf
Indicate whether you agree or disagree with the following statements.pdfIndicate whether you agree or disagree with the following statements.pdf
Indicate whether you agree or disagree with the following statements.pdf
 
Identify any relative maxima or minima and intervals on which the fun.pdf
Identify any relative maxima or minima and intervals on which the fun.pdfIdentify any relative maxima or minima and intervals on which the fun.pdf
Identify any relative maxima or minima and intervals on which the fun.pdf
 
How exposure to an argument through mass media may have influenced o.pdf
How exposure to an argument through mass media may have influenced o.pdfHow exposure to an argument through mass media may have influenced o.pdf
How exposure to an argument through mass media may have influenced o.pdf
 
Find the IPv6 prefix of the address 20010fc3ca540 a0 10 if the .pdf
Find the IPv6 prefix of the address 20010fc3ca540 a0 10 if the .pdfFind the IPv6 prefix of the address 20010fc3ca540 a0 10 if the .pdf
Find the IPv6 prefix of the address 20010fc3ca540 a0 10 if the .pdf
 
Explain the kinds of information that must be maintained in fixed as.pdf
Explain the kinds of information that must be maintained in fixed as.pdfExplain the kinds of information that must be maintained in fixed as.pdf
Explain the kinds of information that must be maintained in fixed as.pdf
 
Dr. P has a culture of stem cells and she wants them to specialize i.pdf
Dr. P has a culture of stem cells and she wants them to specialize i.pdfDr. P has a culture of stem cells and she wants them to specialize i.pdf
Dr. P has a culture of stem cells and she wants them to specialize i.pdf
 
Describe two ecological roles of fungi. Related concepts decomposer.pdf
Describe two ecological roles of fungi. Related concepts decomposer.pdfDescribe two ecological roles of fungi. Related concepts decomposer.pdf
Describe two ecological roles of fungi. Related concepts decomposer.pdf
 
Differential equations using phase plane analysis. Task 1 (Romeo .pdf
Differential equations using phase plane analysis. Task 1 (Romeo .pdfDifferential equations using phase plane analysis. Task 1 (Romeo .pdf
Differential equations using phase plane analysis. Task 1 (Romeo .pdf
 
Develop a stack in c with dynamic memory allocation. Use the followi.pdf
Develop a stack in c with dynamic memory allocation. Use the followi.pdfDevelop a stack in c with dynamic memory allocation. Use the followi.pdf
Develop a stack in c with dynamic memory allocation. Use the followi.pdf
 
Define a struct type that represents a smartphone. The struct should.pdf
Define a struct type that represents a smartphone. The struct should.pdfDefine a struct type that represents a smartphone. The struct should.pdf
Define a struct type that represents a smartphone. The struct should.pdf
 
Changes in the economy have determined that for the EZ shipping comp.pdf
Changes in the economy have determined that for the EZ shipping comp.pdfChanges in the economy have determined that for the EZ shipping comp.pdf
Changes in the economy have determined that for the EZ shipping comp.pdf
 
Broadly speaking, the economy consists of households, firms, governm.pdf
Broadly speaking, the economy consists of households, firms, governm.pdfBroadly speaking, the economy consists of households, firms, governm.pdf
Broadly speaking, the economy consists of households, firms, governm.pdf
 
A committee consists of 13 Republicans and 16 Democrats. How many dif.pdf
A committee consists of 13 Republicans and 16 Democrats. How many dif.pdfA committee consists of 13 Republicans and 16 Democrats. How many dif.pdf
A committee consists of 13 Republicans and 16 Democrats. How many dif.pdf
 
2. July 01 Record the dividend received from the foreign subsidiary..pdf
2. July 01 Record the dividend received from the foreign subsidiary..pdf2. July 01 Record the dividend received from the foreign subsidiary..pdf
2. July 01 Record the dividend received from the foreign subsidiary..pdf
 
You have isolated a new virus, determined it has a lipid envelope,.pdf
You have isolated a new virus, determined it has a lipid envelope,.pdfYou have isolated a new virus, determined it has a lipid envelope,.pdf
You have isolated a new virus, determined it has a lipid envelope,.pdf
 
Write the Java source code necessary to build a solution for the pro.pdf
Write the Java source code necessary to build a solution for the pro.pdfWrite the Java source code necessary to build a solution for the pro.pdf
Write the Java source code necessary to build a solution for the pro.pdf
 
Why is agrobacterium tumfaciens useful to Kant biologists Describ.pdf
Why is agrobacterium tumfaciens useful to Kant biologists Describ.pdfWhy is agrobacterium tumfaciens useful to Kant biologists Describ.pdf
Why is agrobacterium tumfaciens useful to Kant biologists Describ.pdf
 

Recently uploaded

APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 

Recently uploaded (20)

APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 

Here is the company database--comments can be addedD.pdf

  • 1. Here is the company database --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), CONSTRAINT pk_essn PRIMARY KEY (essn, dependent_name),
  • 5. 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);
  • 6. 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));
  • 7. 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
  • 8. 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));
  • 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),
  • 10. 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);
  • 11. 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));
  • 12. 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
  • 13. 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));
  • 14. 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),
  • 15. 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);
  • 16. 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); 2. (30 points) Here are a couple subquery problems regarding to the tables in the company database. you might be tempted to use flat queries to answer some of them, you have to use (if they are not as non-flat query problems) in this question in order to get better understanding to sub queries. (Hints: sample script file and textbook.) To find out the script, visit homework 3 for the script. b) find out the lowest salary for each department (flat query) hint: use group by c) Find out the names of those people whose salary is the lowest salary in each department. (A little bit more challenging, use nested query or called subquery) d) find out ssns of those people who work on two projects. (nested query) e) Find out who works on two projects, i. e, to find out names of those people write a select command to calculate what the salary would be if every body get a 7% raise. (fiat query) g) Write an update command to give all employees in the I Research department a seven percent raise in salary. h Retrieve the names of all employees who have two or more dependents Solution 1. select min(salary) from employee; 2. select min(salary) from employee,department where mgrssn =ssn group by dnumber; 3.select min(salary),fname from employee,department where mgrssn = ssn group by dnumber ,fname; 4 .select ssn ,count(pno) from employee e, works_on where essn= ssn group by ssn having count(pno)>2; 5. select fname ,count(pno) from employee e, works_on where essn= ssn group by ssn,fname having count(pno)>2; 6. select salary*1.07 from employee; 7 . update employee set salary =salary1.07 where ssn in ( select mgrssn from department where dname ='Research');
  • 17. 8. select fname from employee ,dependent where ssn=essn group by ssn having count(1)>2