Question: You will create one script file that contains the SQL syntax of your solution for each query problem. Save the script file as - Assignment
You will create one script file that contains the SQL syntax of your solution for each query problem. Save the script file as Assignmentsql Code comments at the top listing the assignment and your name. Also, code comments such as Query before each query solution. Use MurachCollege database. Submit your script file using the Moodle Asssignment submission link.
Chapter Queries
First create the following tables by running a make table query:
Select into Departments From Departments
Select into Instructors From Instructors
Write an INSERT statement that adds this row to the Departments table:
DepartmentName: History
Code the INSERT statement so SQL Server automatically generates the value for the DepartmentID column.
Write a single INSERT statement that adds these rows to the Instructors table:
InstructorID: The next automatically generated ID
LastName: Benedict
FirstName: Susan
Status: P
DepartmentChairman:
HireDate: Todays date
AnnualSalary:
DepartmentID:
InstructorID: The next automatically generated ID
LastName: Adams
FirstName: null
Status: F
DepartmentChairman:
HireDate: Todays date
AnnualSalary:
DepartmentID:
Write this statement without using a column list.
Write an UPDATE statement that modifies the first instructor you added in exercise This statement should change the AnnualSalary column from to and it should use the InstructorID column to identify the row.
Write a DELETE statement that deletes the second instructor you added in exercise This statement should use the InstructorID column to identify the row.
Code a DELETE statement that deletes all instructors within the Instructors table that are in a department with an ID of Code another DELETE statement that deletes the row in the Departments table that has an ID of
Write an UPDATE statement that increases the annual salary for all instructors in the Education department by To do that, join the Departments and Instructors tables and then filter the rows by the department name.
Write a DELETE statement that deletes instructors that arent teaching any courses. To do that, use a subquery in the WHERE clause OR code an outer join statement.
Run the following Create Table statement to create a table named GradStudents. This table has the same columns as the Students table, but the StudentID column isnt defined as an identity column.
CREATE TABLE GradStudents
StudentID INT PRIMARY KEY,
LastName VARCHAR NOT NULL,
FirstName VARCHAR NOT NULL,
EnrollmentDate DATE NOT NULL,
GraduationDate Date NULL;
Write an INSERT statement that inserts rows from the Students table into the GradStudents table. Include only the rows for students that have graduated, and dont use a column list.
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
