Question: /* Assignment 5 Worth 5% Total Assignment is out of 50 marks Complete all of the questions in this SQL file and submit the file
/*
Assignment 5
Worth 5%
Total Assignment is out of 50 marks
Complete all of the questions in this SQL file and submit the file for grading
Open this file in SQL Workbench to complete all of the statements
Make sure you run the CreateDB Script to create the sample database
You will need it to create the queries based on these tables
There is a .jpg file which shows the tables in the database
*/
/*
Question 1
Write a CREATE table statement that has a PRIMARY KEY column and have that column auto generate a value on INSERT ( 5 marks )
*/
# Put your answer here
/*
Question 2
Write 5 INSERT statements that add data to the table from Question 1 but doesn't include the PRIMARY KEY to test the auto numbering ( 5 marks )
*/
/*
Question 3
Write an ALTER statment to add a date column to the table from Question 1 and set a default of January 1 2020 ( 7 marks )
*/
/*
Question 4
Write an ALTER statment to remove the date column you just added to your table (7 marks)
*/
/*
Question 5
Write a single ALTER statment to modify the name and datatype of two of your columns in your table from Question 1 ( 8 marks )
*/
/*
Question 6
Write a single ALTER statment to add two columns to your table from Question 1, the first column needs a DEFAULT value, the second column needs to be put in between your first and second column of the table ( 8 marks )
*/
/*
Question 7
Write a CREATE table statment that has an ID column (with a PRIMARY KEY and an AUTO generating number) and a description column.
ALTER the table from Question 1 to have that ID column added to it and make a FOREIGN KEY reference
INSERT records into the new table AND UPDATE the table from Question 1 with the new ID fields
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
