Question: sql script for each question Create a table PayRoll with the following info: employee_num INT PRIMARY KEY AUTO_INCREMENT job_id INT NOT NULL job_desc VARCHAR(40) emp_pay

sql script for each question

  1. Create a table PayRoll with the following info:

employee_num INT PRIMARY KEY AUTO_INCREMENT

job_id INT NOT NULL

job_desc VARCHAR(40)

emp_pay DECIMAL (10,2)

  1. Alter PayRoll table with the following, make sure to write each script separately.
  1. Add constraint on emp_pay so that only value greater than 10,000 can be inserted.

ii. Add constraint on job_desc so that default value set to Data Analyst.

iii. Add column pay_date (DATE) after job_desc.

  1. Add Foreign Key constraint in PayRoll table with job_id column referencing to project_num column in Project table.
  1. Insert following values into PayRoll table. DO NOT insert employee_num and job_desc, those should be auto populated using auto_increment and default values, respectively.

job_id

pay_date

emp_pay

10

current date

12000.99

11

current date

14000.99

12

current date

16000.99

  1. Update emp_pay in PayRoll table for employee_num = 2 with 10% emp_pay increase i.e. (emp_pay * 0.10).

11. Create Project_backup table from project table you created above using bulk insert statement only for last_name 'Smith'.

12. Create VIEW as PayRoll_View from PayRoll table you created above. However, your VIEW should only contain job_id, job_desc and pay_date for job_id > 10.

13. Create Index for pay_date on PayRoll table.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!