Roll: 3093 Batch: 50A ID: WUB 03/20/50/3093 Department of CSE
Submission Date: 28/07/2021
Solution
(i) create the database
CREATE DATABASE university; (ii) select the current database USE university; (iii) Create the following tables and Include necessary constraints. a. employee (emp_no,emp_name,DOB, address, doj, mobile_no, dept_no, salary). CREATE TABLE employee { emp_no int NOT NULL UNIQUE, emp_name varchar(25) NOT NULL, DOB DATE NOT NULL, address varchar(50), mobile_no varchar(10), dep_no int NOT NULL, salary int. PRIMARY KEY(emp_no), FOREIGN KEY(dep_no) }; b. department (dept_no, dept_name, location). CREATE TABLE department { dept_no int NOT NULL UNIQUE, Dept_name varchar(25) NOT NULL, location varchar(50), PRIMARY KEY(dept_no) }; . (iv) List all the tables in the current database show tables; (v) Display the structure of the employee table DESCRIBE employee; (vi) Add a new column Designation to the employee table ALTER TABLE employee { add (Designation varchar(25) }; (vii) Drop the column location from Dept table ALTER TABLE employee DROP COLUMN location; (viii) Drop the tables (x) Delete the database DROP TABLE employee; DROP TABLE department; DROP DATABASE university;