Question: Using SQL, carry out the various DML and DDL functions on the tables mentioned below: 1. Insert the data given above in both employee, department
Using SQL, carry out the various DML and DDL functions on the tables mentioned below: 1. Insert the data given above in both employee, department and project tables. 2. Display all the employees information. 3. Display Employee name along with his SSN and Supervisor SSN. 4. Display the employee names whose bdate is 29-MAR-1959. 5. Display salary of the employees without duplications. 6. Display the MgrSSN, MgrStartDate of the manager of Finance department. 7. Modify the department number of an employee having fname as Joyce to 5 8. Alter Table department add column DepartmentPhoneNum of NUMBER data type and insert values into this column only. 9. Alter table department to modify the size of DepartmentPhoneNum. 10. Modify the field name DepartmentPhoneNum of departments table to PhNo. 11. Rename Table Department as DEPT. 12. Alter Table department remove column PhNo. 13. Create a table COPYOFDEPT as a copy of the table DEPT. 14. Delete all the rows from COPYOF DEPT table. 15. Remove COPYOF DEPT table.
Mention the SQL code used and the Output for each and every part.
Table Name: Employee
| Attribute | Data Type |
| First Name | VARCHAR(15) |
| Mid Name | CHAR(2) |
| Last Name | VARCHAR(15) |
| SSN Number | CHAR(9) |
| Birthday | DATE |
| Address | VARCHAR(50) |
| Sex | CHAR(1) |
| Salary | NUMBER (7) |
| Supervisor SSN | CHAR(9) |
| Department Number | NUMBER (5) |
Table Name: Department
| Attribute | Data Type |
| Department Name | Varchar(15) |
| Department Number | Number(5) |
| ManagerSSN | CHAR(9) |
| ManageStartDate | DATE |
Table Name: Project
| Attribute | Data Type |
| Project Name | VARCHAR(15) |
| Project Number | NUMBER(5) |
| Project Location | VARCHAR(15) |
| Department Number | NUMBER(5) |
Data For Employee Table
| FName | Mini t | LName | SSN | BDate | Address | Sex | Salary | SuperSSN | DepNo |
| Doug | E | Gilbert | 554433221 | 09-JUN-60 | 11 S 59 E, Salt Lake City, UT | M | 80000 | NULL | 3 |
| Joyce | PAN | 543216789 | 07-FEB-78 | 35 S 18 E, Salt Lake City, UT | F | 70000 | NULL | 2 | |
| Frankin | T | Wong | 333445555 | 08-DEC- 45 | 638 Voss, Houston, TX | M | 40000 | 554433221 | 5 |
| Jennifer | S | Wallace | 987654321 | 20-JUN-31 | 291 Berry, Bellaire, TX | F | 43000 | 554433221 | 4 |
| John | B | Smith | 123456789 | 09-JAN-55 | 731 Fondren, Houston, TX | M | 30000 | 333445555 | 5 |
| Ramesh | K | Narayan | 666884444 | 15-SEP-52 | 975 Fire Oak, Humble, TX | M | 38000 | 333445555 | 5 |
| Joyce | A | English | 453453453 | 31-JUL-62 | 5631 Rice, Houston, TX | F | 25000 | 333445555 | 5 |
| James | E | Borg | 888665555 | 10-NOV- 27 | 450 Stone, Houston, TX | M | 55000 | 543216789 | 1 |
| Alicia | J | Zelaya | 999887777 | 19-JUL-58 | 3321 Castle, Spring, TX | F | 25000 | 987654321 | 4 |
| Ahmad | V | Jabbar | 987987987 | 29-MAR- 59 | 980 Dallas, Houston, TX | M | 25000 | 987654321 | 4 |
Data For Department table
| DName | DepNo | MgrSSN | MgrStartDate |
| Manufacture | 1 | 888665555 | 19-JUN-71 |
| Administration | 2 | 543216789 | 04-JAN-99 |
| Headquarter | 3 | 554433221 | 22-SEP-55 |
| Finance | 4 | 987654321 | 01-JAN-85 |
| Research | 5 | 333445555 | 22-MAY-78 |
Data For Project
| PName | PNumber | Plocation | DepNo |
| ProjectA | 3388 | Houston | 1 |
| ProjectB | 1945 | Salt Lake City | 3 |
| ProjectC | 6688 | Houston | 5 |
| ProjectD | 2423 | Bellaire | 4 |
| ProjectE | 7745 | Sugarland | 5 |
| ProjectF | 1566 | Salt Lake City | 3 |
| ProjectG | 1234 | New York | 2 |
| ProjectH | 3467 | Stafford | 4 |
| ProjectI | 4345 | Chicago | 1 |
| ProjectJ | 2212 | San Francisco | 2 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
