Question: Module 2 Assignment 2 - Basic DDL Statements Overview In this assignment, you will be using SQL command to create tables, populate the tables with
Module Assignment Basic DDL Statements
Overview
In this assignment, you will be using SQL command to create tables, populate the tables with some data, then make update and delete records in the tables.
Instructions
Connect to the compsci server in MySQL Workbench. You have access to several databases. However, you only have write privilege to one database that is named by your user name. For example, if your MySQL username is xliu, then you can only create a table, insert into, update, or delete in the xliu database. For this assignment, make sure you use that database.
Download the SQL file, then answer the following questions in that file.
Use Create Table command, create a department tables with the following attributes.
Attribute Data Type
deptname as primary key
varchar
building
varchar
budget
numeric up to digits, with decimal point
Use Create Table command, create an instructor tables with the following attributes.
Attribute Data Type
id as primary key
int
fname
varchar
lname varchar
salary numeric up to digits, with decimal point
deptname as foreign key referencing department
varchar
Insert records into each table records in total You could make up your data. Try creating a new record in the instructor table first, what happens? Yes you must have some data in department table before you can insert into instructor table. Indeed, the order of step and cannot be reversed either you must create department before instructor because of the foreign key constrain.
Write a SQL command to give a salary raise to instructors in a specific department you pick.
Write a SQL command to give a salary raise to instructors in the department that has the highest budget. Hint: you may use sub queries for this problem.
Delete all instructors of a specific department you choose you may have to go to MySQL Workbenchs menu Edit Preferences SQL Editor, scroll down to the bottom then uncheck Safe Updates
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
