Consider the following employee database schema:
EMPLOYEE (ESSN, ENAME, DEPT_NO, SALARY) DEPENDENT (ESSN, DEPEND_NAME, RELATION, DOB) DEPARTMENT (DEPT_NO, DEPT_NAME, MANAGER)
Consider the following employee database schema:
EMPLOYEE (ESSN, ENAME, DEPT_NO, SALARY)
DEPENDENT (ESSN, DEPEND_NAME, RELATION, DOB)
DEPARTMENT (DEPT_NO, DEPT_NAME, MANAGER)
(a) mysql code to Create the appropriate database.
(b) Perform following queries using SQL:
(i) Find details of dependents for employee having name AJAY.
(ii) Find the name of the manager of the department in which employee with ESSN Code 5078 works.
(iii) Find the name of all employees whose age is less than 18 years.
(iv) Find the DOB of the son of the employee having employee code ESSN 5078.
(v) Find the details of the departments in which the employee having employee code ESSN 5078 has worked.
(c) Create the procedures for the above queries.
(d) Write appropriate triggers, exceptions and functions for the above employee database schema.
(a) Code to Create the appropriate database:
CREATE DATABASE EmployeeDB;
USE EmployeeDB;
CREATE TABLE EMPLOYEE (
ESSN INT PRIMARY KEY,
ENAME VARCHAR(255),
DEPT_NO INT,
SALARY DECIMAL(10,2)
);
CREATE TABLE DEPARTMENT (
DEPT_NO INT PRIMARY KEY,
DEPT_NAME VARCHAR(255),
MANAGER VARCHAR(255)
);
CREATE TABLE DEPENDENT (
ESSN INT,
____ ______ _________ _______ ____ ________.
_______ _________ _________ ________ _________ __________ _______.
________ _______ _______ ____ __________ ________ ___ ________ _______ ________ __________ _____.
_________ ___ _______ _________ ________ __________.
________ _______ ________ ___ _________.
______ _________ _____ _______ ________ _______.
___ ____ _________ ___ _____ _________ ____ ______ ______ ______ ________.
______ __________ ________ ________ _____ ___ ___ ___ _______.
_________ __________ _______ _________ ____.
_____ ________ _____ _________ _______ ___ ___.
______ ________ ______ ____ ______ _______ _______ ______ ________ _______ ________ _____.
_____ _________ _________ __________ ______ __________ ____ __________ _______ _______ _________ ________.
____ ______ ___ __________ _____ ________ ___ ___ _________ ___.
_____ _______ _____ ______ _____ _____.
___ ___ ________ _____ ______ ___ ________.
_______ __________ ____ ___ ______ ___ ______ ______ ___.
_______ _________ _________ ___ _______ __________ ___ ____ ____ _____ ______.
_______ _____ __________ ________ ____ _____ ___ ____ _________.
_______ ____ ______ _________ __________ _______.
____ __________ ____ ___ ______ ___ ___ __________ __________ ______ ________ _______.
_____ _____ __________ _____ ________ ______ ___ ______.
____ _________ ___ _______ _________ ______ ____.
__________ _________ ___ _______ _____ ________ _________ _______ __________ ___ ___ ____.
___ ____ _____ ______ _____ _________.
___ _________ ___ _____ ____.
___ ________ ____ _____ _________ ___ ______ _______.
____ ______ __________ _____ _______.
___ ______ ______ ___ _________ ____ _________ ______.
_____ _____ ___ ________ __________.
_______ ________ ________ ________ ____.
___ _________ ______ ____ ________ _______ ____ __________.
__________ ___ ______ __________ _______.
_______ ______ ______ __________ ___ _______ __________ ______ _________.
_____ ___ ________ ___ _________ ______.
_____ ____ ___ ______ __________ ________ ______.
____ ____ ____ ________ __________ _____ ___ _______ ______ __________ _________ ________.
_______ _____ ___ ____ ______ _______ _______ _____ __________.
___ __________ _______ _________ ________ ____ ____ _______ ______ ______ ___.
______ __________ ______ ___ _____ _____ _______ __________ ___.
_____ ____ ____ __________ __________ ________.
___ ________ __________ ________ ___ _______ ___ ________ __________ ___ __________.
_______ ________ ________ ___ _______ ___ ______.
________ ____ _____ ______ ___ ______ _________.
__________ _______ ___ ___ ____.
____ _______ ______ ________ ________.
_______ ________ _________ _____ ________ __________ _________ ____ _____ _________ _______ ______.
________ ____ ___ ____ _________ ___ ____ ______ _______ ___ ______ ____.
______ __________ _______ ___ ____ __________ _____ _________ _____ ________.
_________ ____ ___ ___ _____ __________ ______ ______ _________.
________ ___ _________ _________ ______ _______ _______ ______.
________ _____ ____ _____ _________ _____ ___ _______ ________ _____ ____.
__________ ________ __________ ___ _____ ____.
________ ______ ________ _________ ____.
______ _______ _______ ______ _________ _______ ________ _________ ___.
_____ ______ _____ _________ _______.
______ _________ __________ ______ ________ ____ ___ _________ ___.
______ _____ _______ ______ ___ _____ ___ _____ ____ _____.
____ __________ ___ _______ __________ _________ _________ ____ ____ ____.
___ ____ ____ ________ _________ _________ ___ _________ _________ ____.
________ _____ ___ ______ _______.
____ __________ ________ ________ __________ _______ _______ _________ ___ ________ __________ _______.
_______ ____ ______ ________ ___ ________ ________ _________ ___ _____ ________ _______.
_____ ________ ____ ____ _______.
__________ ______ ___ ______ ______ _________ ________.
_______ _________ ________ _____ ____ ____ _______ ___.
______ ___ _______ ______ _________ __________ ____ ______ ____ _______.
__________ ____ _____ ______ _______ ___ ___.
__________ _____ ___ _____ _______ ____ ______ _________ _______ __________.
____ _______ ________ __________ ___ ________ ___ _________ ____ ________ __________ ____.
__________ _______ ________ __________ _________.
_________ ____ ________ _______ __________ ________ ___ _____ __________ ___ ________.
_________ __________ ____ ________ _____ _____ ________ _________ _______ ________ __________.
_____ ___ ________ ________ __________ ____ __________ ______ ____ ______ _______.
_____ ______ ___ _____ ________ ______ ______.
_____ _____ _____ ___ _____ _____.
_______ ________ _________ ___ ____ _____ _________.
_______ _____ ________ ________ ____ ___ _______ _______ _____ ___ _________.
__________ ____ _______ _________ _____.
_____ ___ __________ _______ ______.
_____ _______ _____ _________ _____ ______ __________.
_________ ______ __________ __________ ____ ______ __________ __________.
_______ ____ _______ _____ _________ _____ ______ _______.
___ ___ ____ ____ ____ ____ ___ _______ _______ ____.
_____ __________ ___ _______ ______ ______ _________ _________ ______.
______ ______ _____ ______ ______ __________ _________ ________ _______ ___.
_________ _______ _____ ____ ________.
____ ____ _________ ______ _________ ______.
_________ __________ ______ __________ ________ _____ ______ ________ _____ _______ ________.
_______ ______ _______ ___ _______ __________ _______ ___.
________ ______ ________ ________ _____ _______ ___ _________ _____ ___.
________ ________ ____ __________ ________.
_________ ______ __________ _______ _________ _________ ____ __________ _________ _______ __________ __________.
_________ ___ _________ ___ ______ ___ __________ ________ ________ ___ ______ __________.
__________ ____ _________ _______ _______ _____ ___ _________.
_____ _____ ________ __________ ______ _________ ____ _______ ________ _________.
______ ___ _______ ___ ______ __________ ________ _________ ______.
___ __________ _____ ______ __________ ____ _________.
_________ ____ _________ ____ _________ _____ ________.
________ ______ ________ __________ ______ _______ _____ ______ ____.
__________ _________ _____ ____ ___.
_____ ___ _______ ___ _____ __________ _____ _____ __________.
Get Full Answer on WhatsApp