Question: single SQL script Through the script, create normalized tables (using CREATE TABLE) with constraints, following the process of normalization up to 4NF. The tables need
single SQL script
Through the script, create normalized tables (using CREATE TABLE) with constraints, following the process of normalization up to 4NF. The tables need to be linked through SQL code, when you create tables or when you alter table structure (for example, you may use primary key, foreign key, references in SQL code). It may be easier to add the keys or constraints (through ALTER TABLE in SQL) after you insert data, per question 3 below. The following are the assumptions you must consider. An employee must have one name, a date of birth and may have multiple addresses. Each employee is identified by the SSN. Each employee may belong to multiple departments at a time. A department may have many employees. A department is identified by Department_id. Each department must have one name. Each department headquarter must be located at one city in USA. Each city may have many department headquarters. A project is identified by Project_number. Each project must have one name. A project may be in multiple locations across the world. A project may be associated with multiple departments. An employee may work in multiple projects at a time. An employee may not be associated with any project. Each employee has a fixed monthly salary that varies among employees, plus a project salary based on number of hours worked in a project and project salary rate. The project salary rate varies for different employees and different projects, but the minimum rate is $12 per hour. [20 points] Insert suitable data in all tables (using INSERT INTO) so that the queries in question 4 can be run properly. For the minimum, consider the following data. John works in the projects named SQL_customer11 and SQL_customer12. SQL_customer11 project has locations as Paris, New Delhi and Kolkata. SQL_customer12 has locations as Paris, New Delhi and Fontainbleau. Joseph does not work in any project. Jack works in project named Java_customer11 that has locations in Beijing and Shanghai. John works in both Core Marketing department and Marketing Research department. Joseph works in Human Resources department. Jack works in Core Marketing department. The headquarter locations for Core Marketing department and Marketing Research department are both New York City. The headquarter location for Human Resources department is San Francisco. In February 2021, John was paid a monthly salary of $5000 plus $15 per hour for both his projects. He worked for 80 hours each per month in both his projects. In February 2021, Joseph was paid a monthly salary of $5500. In February 2021, Jack was paid a monthly salary of $6000. Jack did not work any hour in his project in February 2021. Write SQL SELECT statements to get the following queries. What are the distinct project locations that a particular employee (John, Joseph and Jack, for example) is associated with? (Answer: New Delhi, Kolkata, Paris, Fontainbleau for John. Blank for Joseph. Beijing and Shanghai for Jack) [25 points] What are all the distinct cities of the department headquarter that a particular employee (John, Joseph and Jack, for example) is associated with? (Answer: New York City for John. San Francisco for Joseph. New York City for Jack) What was the fixed salary, project salary and total salary, employee-wise, for the month of February 2021? (Answer: John was paid $5000 + $2400 = $7400 total, Joseph was paid $5500 + $0 = $5500 total. Jack was paid total $6000 + $0 = $6000 total. )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
