Question

Consider the following employee database schema:

EMPLOYEE (ESSN, ENAME, DEPT_NO, SALARY) DEPENDENT (ESSN, DEPEND_NAME, RELATION, DOB) DEPARTMENT (DEPT_NO, DEPT_NAME, MANAGER)

16 Sep 2022
Answer :
Word Count : 1040

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,
  DEPEND_NAME VARCHAR(255),
  RELATION VARCHAR(255),
  DOB DATE,
  FOREIGN KEY (ESSN) REFERENCES EMPLOYEE (ESSN)
);

(b) i. Find details of dependents for employee having name AJAY.

SELECT DEPENDENT.ESSN, DEPEND_NAME, RELATION, DOB
FROM EMPLOYEE, DEPENDENT
WHERE EMPLOYEE.ESSN = DEPENDENT.ESSN
AND ENAME = 'AJAY';

(b) ii. ________ __________ _________ _________ ______ ____ _________ _________ _______.
_______ _______ _________ ___ ________ _________ __________ _____ _________.
_______ __________ ______ _______ ______.
__________ __________ _________ _____ __________.
______ __________ _____ _______ _____ _________.
______ __________ ______ _______ _____ ________ ________.
_______ ______ ____ _____ _______.
___ ________ ____ __________ ___.
__________ ________ _____ _____ _____ ___ ________ ___.
_______ __________ ____ ____ ________ _____ ____ ____ ________.
____ _____ ________ _________ ____ _________.
________ _____ ____ ________ _____ ________.
________ __________ ___ ___ _______ ___ _________ ___ ______ _________ ________ ___.
__________ _________ _____ _____ __________ _____.
_____ ______ _______ ___ _______ ________ ____.
__________ __________ ___ _________ _______ _________ __________ _______ ____.
_______ _____ ______ ______ __________ __________ ________ ____ _____ ______ _________.
_______ ___ ____ ____ __________.
_______ _____ ___ ____ ___ ________ _____ __________ _______ _____ _____ ___.
__________ ______ _______ __________ ____ __________ ___ _______.
____ _______ ____ ________ ___ ______ ________ ____.
________ ________ ______ ________ _________ __________ __________ ______ ___ ________ ______ ________.
___ __________ _________ ______ _______ ______ _______ _______.
________ ________ _______ __________ _________.
____ _______ _________ ___ ________ _______ __________.
___ _______ __________ _____ _________ ___ _______ _______ ____.
_____ __________ _____ _______ _____ _________ _______ _________ ___ ___ _______.
_____ _______ __________ ____ _________ _________ ________ ____ ______ __________.
___ _____ _________ ________ __________ _______ _____ __________ ________.
_________ ____ _______ _____ ___ ___ __________ _____ _________ _______ ____ ____.
____ __________ ________ __________ _____.
_____ __________ ________ ________ ____ ______.
____ __________ __________ _________ ________ ____ _________ _______ ______ ________.
____ ___ __________ ____ ________ ____ ______ _____ __________.
______ ______ _______ _________ ___ _____ ______.
____ __________ ___ ____ _______ _________ __________ ________ ___ ___.
_________ ____ ____ _____ _____.
_____ ________ _________ __________ _______ ________ ________ ________ _______ _________ _______.
_______ __________ __________ _________ _________ _______ _______.
___ _____ ________ ______ ________ _______ _____ ___ ____ _______ ____ _____.
________ ______ _________ _________ _________ _______ ______ ____ ________ ____.
___ ______ ____ _____ ____ _________ __________ ___ ___ ________ ____ __________.
__________ ___ _________ _______ ______ ___ __________.
____ ___ _____ __________ ______ _________.
_________ ________ __________ _______ __________ ____ ___ ______ __________ ___ _____ ______.
_________ __________ _______ ____ _____ ______ __________ __________ ____ ________ __________.
_________ ____ ______ ____ ________ _____ _____ _______ ____.
___ _______ ______ _____ _____ _________.
___ ________ _____ ___ ________ _________ ___ __________ _________ ___.
___ ___ _________ __________ ______ ___.
______ ______ _______ _____ ___ _____.
____ _________ _____ _____ __________ ____ _________ _______ _________ ____ __________.
____ _____ ___ ___ ______ _____ ________ ________.
___ _____ ____ _____ __________ _________ ______ ________.
_______ ___ ______ ______ _______ _______ ___ __________ ___ __________ ________.
_______ _____ __________ __________ _______ __________ _______.
___ ____ __________ __________ ____.
_____ ______ _______ _____ _________ _____ ______.
_________ _____ ____ ________ ___.
________ __________ ________ ______ _______ __________ _______.
____ ___ ______ ___ _________ _________ ________.
______ _________ ________ ____ ________ ____.
______ _________ _______ _________ _______ ____ _________ ________ ________ _____.
________ _________ ___ _____ ____ _________ _____ ______ ____ ____.
_________ _________ _______ _____ ________ _________ _________ _________ _________.
_______ ___ ____ ______ ______ ________ _____ ______ ________ _________ _______.
_________ _______ _____ __________ _________ ________ _______ __________ _____ ___ _______ _______.
________ ____ _____ _________ ___ ______ ________ _______ ____ ______ ________.
_______ _________ __________ _________ _________ _______ _____ ______ __________ _____ __________.
________ ______ ___ ________ ________ ____ _________ ___ _________ ____.
_____ __________ _____ _______ _____ ____ __________ ___ _________ __________ ________.
_____ _____ _____ ___ __________ _________ ____ ______ ______.
__________ _________ ___ _____ _______ _________ ___ _______ _______ _______ _____ _____.
________ ______ ____ ____ ________ ___ _________.
______ _________ ________ _________ _______ ___ _________ ____ _________ _________.
________ ___ ___ ____ _____.
____ ______ _________ _________ __________.
___ ________ __________ _________ ___ ___ _____.
_______ _______ _______ _________ _______ _______ ____ ______ ____.
____ _____ _________ _______ ______.
_______ _____ _____ __________ ________ __________ __________ __________ _________ __________.
_______ ________ _________ _______ ________ __________.
_________ __________ ________ _______ ___ ____ ___ _______ ________ ________ ______ ____.
_____ ______ _____ __________ _______ _________ _____ _______ _____ ___ _________ _____.
____ _______ _______ _________ ____.
___ _____ ____ ___ _________.
__________ _____ _________ _____ __________ ________ _____.
_____ _____ __________ ___ _______ ____ _________ ______ ____.
__________ ____ ________ _______ ________.
_______ ______ _________ _______ _________ __________ __________ _____.
_______ _______ ___ __________ ___ ____.
___ __________ __________ _________ ____ ___ ___ _____ ____ ___.
__________ ______ __________ ___ ___ ___ ______.
_____ ___ _______ _______ ________ _____ _________.
_____ ___ ___ __________ ___ _________.
________.
Get Full Answer on WhatsApp

IGNOU NEWS
Assignment Submission Last Date Extended Till 30 June 2026 Click Here★★★IGNOU June 2026 TEE Date Sheet Released Click Here★★★
Top
📞
Call Support Instant phone assistance Consider the following employee database schema:EMPLOYEE (ESSN, EN
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→