Question
Figure 5.3 shows the DDL for creating the Worker and Projects database with the following schema: a. Get the names of all workers in the
Figure 5.3 shows the DDL for creating the Worker and Projects database with the following schema:
a. Get the names of all workers in the Accounting department. b. Get an alphabetical list of names of all workers assigned to project 1001. c. Get the name of the employee in the Research department who has the lowest salary. d. Get details of the project with the highest budget. e. Get the names and departments of all workers on project 1019. f. Create a view that has the project number and name of each project, along with the IDs and names of all workers assigned to it. g. Change the hours that employee 110 is assigned to project 1019, from 20 to 10.
CREATE TABLE Worker empId astName firstName deptName birthDate hireDate salary NUMBERI6) PRIHARY KEY ARCHAR2120) NOT NULL. ARCHAR2115) NOT NULL. VARCHAR2I15 DATE DATE NUMBER(B.2)): CREATE TABLE Dept deptName mgrid CONSTRAINT Dept deptNane pk PRIMARY KEY (deptNane. CONSTRAINT Dept-mgrla_fk FOREIGN KEY {mgrld) REFERENCES Orker(emp Id) ON DELETE SET NULL); ARCHAR2115) NUMBERI6) ALTER TABLE Worker ADD CONSTRAINT Worker_deptNane fk FOREIGN KEY (dept.Name) REFERENCES Dept(dept Name ) ON DELETE SET NULL; CREATE TABLE Project projNo projName projMgrId budget startDate expectedDurationWeeks UMBER(4). CONSTRAINT Project-projNo_pk PRIMARY KEY proj No), CONSTRAINT Project projMgrId fk FOREIGN KEY (projMgrId) REFERENCES HORKER(empld) ON DELETE SET NULL) NUMBERI6) ARCHAR2120) NUMBER(6). NUMBER(B.2). DATE CREATE TABLE Assign projNo empId hoursAssigned NUMBERI3) rating CONSTRAINT Assignprojio empld pk PRIMARY KEY (projNo. empld CONSTRAINT Assign-proj No-fk FOREIGN KEY(projNo] REFERENCES Project (projNo} ON DELETE CASCADE CONSTRAINT Assign empld_fk FORETGN KEY enpId) REFERENCES Worker(empd) ON DELETE CASCADE) NUMBERC6). MBERC6) NUMBER( 1 ) , INSERT INTO Dept VALUES (Accounting null) NSERT INTO Dept VALUES *Research'.nul1) "Accounting. "O1-Feb-1970. 06-Jun-1993.50000 ); INSERT INTO Worker VALUES101. Snt th Ton INSERT INTD worker VALUES{ 103,' Jones. .Hary". "Accounting. "15. Jun-1975. "20. Sep 2005",48000; INSERT INTO Worker VALUES105. BurnsJane"Account ing'. "21-Sep-19812-Jum-2000* .39000); INSERT INTO Worker VALUES 110. "Burns. .Michael. ""Research". "05-Apr-1977. "10-Sep-2010',70000): INSERT INTO Worker VALUES{ 115,"chin' *Amanda", "Research". "22-Sep-1980*.'19-Jun-2014*.60000): UPDATE Dept SET mgria- 101 WHERE deptane - 'Accounting": UPDATE Dept SET mgrta-110 NHERE deptaneResearch: INSERT INTO Project VALUES (100 'Jupiter.101. 300000 01-Feb-2014. 50): IWSERT INTO Project VALUES (1005. 'Saturn*. 101. 400000. 01-Jun-2014". 35) INSERT INTO Project VALUES (1019 "Mercury.. 110. 350000. "15-Feb-2014. 401; INSERT INTO Project VALUES (1025 Neptune. 110, 600000. 01-Feb-2015, 45) INSERT INTO Project VALUES (1030. 'Pluto110. 380000. "15-Sep-2014". 50): INSERT INTO Assign VALUES 1001,10, 30.nutl) INSERT INTO Assign VALUESI1001 103. 20.5): INSERT INTO Assign VALUES 1005. 103, 20,num: INSERT INTO Assign VALUES1001. 105. 30 nul1): INSERT INTO Ass1gn VALUES( 1001 . 115, 20,4); INSERT INTO Assign VALUES109110. 20.5 INSERT INTO Assign VALUES{ 1019. 115, 10,4); INSERT INTO Assign VALUES(1025. 10. 10.nul1): INSERT INTO ASS1gn VALUES1030. 110 10.null)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started