33
LAB GUIDE Compiled by : Venkata R Voleti RELATIONAL DATABASE MANAGEMENT SYSTEM

RDBMS Lab Guide

Embed Size (px)

Citation preview

Page 1: RDBMS Lab Guide

LA

B G

UI

DE

Compiled by : Venkata R Voleti

RELATIONAL

DATABASE

MANAGEMENT

SYSTEM

Page 2: RDBMS Lab Guide
Page 3: RDBMS Lab Guide

LA

B G

UI

DE

RELATIONAL DATABASE MANAGEMENT SYSTEMENTS

3

LAB GUIDE STRUCTURE

DAY 1 ASSIGNMENTS

Assignment 1 ER MODELLING TECHNIQUES

Assignment 2 ER MODELLING TECHNIQUES

Assignment 3 ER MODELLING TECHNIQUES

Assignment 4 ER MODELLING TECHNIQUES

Assignment 5 ER MODELLING TECHNIQUES

DAY 2 ASSIGNMENTS

Assignment 6 ER AND NORMALISATION TECHNIQUES

Assignment 7 ER AND NORMALISATION TECHNIQUES

Assignment 8 ER AND NORMALISATION TECHNIQUES

Assignment 9 ER AND NORMALISATION TECHNIQUES

Assignment 10 ER AND NORMALISATION TECHNIQUES

Assignment 11 ER AND NORMALISATION TECHNIQUES

DAY 3 ASSIGNMENTS

Assignment 12 TABLE CREATION

Assignment 13 INSERTION OF DATA INTO TABLES

Assignment 14 DATA RETRIEVAL TECHNIQUES

Assignment 15

DAY 4 ASSIGNMENTS

Assignment 16

Assignment 17

Assignment 18

Assignment 19

DAY 5 ASSIGNMENTS

Assignment 20

Assignment 21

PROJECT REFER TO PROJECT FOLDER TO FIND THE PORJECT SPECIFICATIONS

DAY 6 ASSIGNMENTS

Page 4: RDBMS Lab Guide
Page 5: RDBMS Lab Guide

LA

B G

UI

DE

DAY 1 ASSIGNMENTS

Construct an ER Diagram for a car insurance company whose customers own one or more cars each. Each car has associated with it zero to any number of recorded accidents.

RELATIONAL DATABASE MANAGEMENT SYSTEM 5

ASSIGNMENT 1 : ER MODELLING TECHNIQUES

Page 6: RDBMS Lab Guide

LA

B G

UI

DE

DAY 1 ASSIGNMENTS

Design an ER Diagram for keeping track of the exploits of your favorite sports team. You should store the matches played, the scores in each match, the players in each match, and individual player statistics for each match. Summary statistics should be modeled as derived attributes.

RELATIONAL DATABASE MANAGEMENT SYSTEM 6

ASSIGNMENT 2 : ER MODELLING TECHNIQUES

Page 7: RDBMS Lab Guide

LA

B G

UI

DE

DAY 1 ASSIGNMENTS

A company has several business units. Each business unit has multiple projects. Employees must be assigned to one business unit. One or more employees are assigned to a project , but an employee may be on vacation and not assigned to any projects. One of the assigned employees will be project manager for that project.

RELATIONAL DATABASE MANAGEMENT SYSTEM 7

ASSIGNMENT 3 : ER MODELLING TECHNIQUES

Page 8: RDBMS Lab Guide

LA

B G

UI

DE

DAY 1 ASSIGNMENTS

In a hospital there are different departments. Patients are treated in these departments by the doctors assigned to patients. Usually each patient is treated by a single doctor, but in rare cases they will have two or three. Healthcare assistants will also attend to patients; every department has many healthcare assistants. Each patient is required to take a variety of drugs during different parts of the day such as morning, afternoon and night.

RELATIONAL DATABASE MANAGEMENT SYSTEM 8

ASSIGNMENT 4 : ER MODELLING TECHNIQUES

Page 9: RDBMS Lab Guide

LA

B G

UI

DE

DAY 1 ASSIGNMENTS

A toy manufacturing company manufactures different types of toys. The company has several manufacturing plants. Each plant manufactures different types of toys. A customer can place the order for these toys. Each order may contain one or more toys. Each customer has multiple ship-to addresses. To promote the business, the company offers different schemes based on the order value.

RELATIONAL DATABASE MANAGEMENT SYSTEM 9

ASSIGNMENT 5 : ER MODELLING TECHNIQUES

Page 10: RDBMS Lab Guide

LA

B G

UI

DE

DAY 2 ASSIGNMENTS

An University registrar’s office maintains data about the following entities. A. Courses , including member , title , credits ,syllabus ,

prerequisites B. Course Offerings , including course number , year , semester ,

section number , instructor(s), timings, and class room; C. Students including Student ID , name , and program ; D. Instructors , including identification number , name ,

department and title

Further the enrolment of the students in courses and grades awarded to students in each course they are enrolled for must be appropriately modeled. Construct an ER Diagram for the Registrar’s office. Document all assumptions that you can make about the mapping constraints.

RELATIONAL DATABASE MANAGEMENT SYSTEM 10

ASSIGNMENT 6 : ER AND NORMALISATION TECHNIQUES

Page 11: RDBMS Lab Guide

LA

B G

UI

DE

DAY 2 ASSIGNMENTS

Consider a Database used to record the marks the students get in different exams of different course offerings. A. Construct an ER Diagram that models exams as entities

and uses a ternary relationship, for the database B. Construct an alternative ER Diagram that uses only a binary relationship between students and course offerings. Make sure that only one relationship exists between a particular student and course offering pair, yet you can represent the marks that a student gets in different exams of a course offering.

RELATIONAL DATABASE MANAGEMENT SYSTEM 11

ASSIGNMENT 7 : ER AND NORMALISATION TECHNIQUES

Page 12: RDBMS Lab Guide

LA

B G

UI

DE

DAY 2 ASSIGNMENTS

Consider a University database for the scheduling of class rooms for final exams. This database could be modeled as the single entity set exam, with attributes course name, section number, room number and time. Alternatively one or more additional entities sets could be defined , along with relationship sets to replace some of the attributes of the exam entity set, as

• Course with attribute name , department and c_number • Section with attributes s_number and enrollment ,

dependent as a weak entity set on course • Room with attributes r_number , capacity ,and building

A Show an ER Diagram illustrating the use of all three

additional entity sets listed. B Explain what application characteristics would

influence a decision to include or not include each of the additional entity sets.

RELATIONAL DATABASE MANAGEMENT SYSTEM 12

ASSIGNMENT 8 : ER AND NORMALISATION TECHNIQUES

Page 13: RDBMS Lab Guide

LA

B G

UI

DE

DAY 2 ASSIGNMENTS

Convert following table to 3NF table. Please add appropriate columns in normalized tables to make 3NF compliant.

RELATIONAL DATABASE MANAGEMENT SYSTEM 13

ASSIGNMENT 9 : ER AND NORMALISATION TECHNIQUES

Page 14: RDBMS Lab Guide

LA

B G

UI

DE

DAY 2 ASSIGNMENTS

Draw the E-R diagram for normalized Relational schema arrived in ASSIGNMENT 9.

RELATIONAL DATABASE MANAGEMENT SYSTEM 14

ASSIGNMENT 10 : ER AND NORMALISATION TECHNIQUES

Page 15: RDBMS Lab Guide

LA

B G

UI

DE

DAY 2 ASSIGNMENTS

Convert the ER model into a relational Schema

RELATIONAL DATABASE MANAGEMENT SYSTEM 15

ASSIGNMENT 11 : ER AND NORMALISATION TECHNIQUES

Page 16: RDBMS Lab Guide

LA

B G

UI

DE

DAY 3 ASSIGNMENTS

Create two tables - EMP & DEPT EMPLOYEE

DEPARTMENT

Check whether the table structures are created

Column name Data type Description

EMPNO Number Employee number

ENAME Varchar Employee name

JOB Char Designation

MGR Number Manager’s Emp. number

HIREDATE Date Date of joining

SAL Number Basic Salary

COMM Number Commission

DEPTNO Number Department Number

Column name Data type Description

DEPTNO Number Department number

DNAME Varchar Department name

LOC Varchar Location of department

RELATIONAL DATABASE MANAGEMENT SYSTEM 16

ASSIGNMENT 12 : TABLE CREATION

Page 17: RDBMS Lab Guide

LA

B G

UI

DE

DAY 3 ASSIGNMENTS

Data for EMP

Data for DEPT table

7369 Smith Clerk 7902 17/12/80 800 20

7499 Allen Salesman 7698 20/2/81 1600 300 30

7521 Ward Salesman 7698 22/2/81 1250 500 30

7566 Jones Manager 7839 2/4/81 2975 20

7654 Martin Salesman 7698 28/9/81 1250 1400 30

7698 Blake Manager 7839 1/5/81 2850 30

7782 Clark Manager 7839 9/6/81 2450 10

7788 Scott Analyst 7566 9/12/82 3000 20

7839 King President 17/11/81 5000 10

7844 Turner Salesman 7698 8/9/81 1500 0 30

7876 Adams Clerk 7788 12/1/83 1100 20

7900 James Clerk 7698 3/12/81 950 30

7902 Ford Analyst 7566 4/12/81 3000 20

7934 Miller Clerk 7782 23/1/82 1300 10

10 Accounting New York

20 Research Dallas

30 Sales Chicago

40 Operations Boston

RELATIONAL DATABASE MANAGEMENT SYSTEM 17

ASSIGNMENT 13 : INSERTION OF DATA INTO TABLES

Page 18: RDBMS Lab Guide

LA

B G

UI

DE

DAY 3 ASSIGNMENTS

Perform the following queries on the EMPLOYEE and DEPARTMENT table:

♦ List the names of analysts and salesmen.

♦ List details of employees who have joined before 30 Sep 81.

♦ List names of employees who are not managers.

♦ List the names of employees whose employee numbers are 7369, 7521, 7839, 7934,

7788.

♦ List employees not belonging to department 30, 40, or 10.

♦ List employee names for those who have joined between 30 June and

31 Dec. ‘81.

♦ List the different designations in the company.

♦ List the names of employees who are not eligible for commission.

♦ List the name and designation of the employee who does not report to anybody.

♦ List the employees not assigned to any department.

♦ List the employees who are eligible for commission.

♦ List employees whose names either start or end with “S”.

♦ List names of employees whose names have “i” as the second character.

♦ List the number of employees working with the company.

♦ List the number of designations available in the EMP table.

♦ List the total salaries paid to the employees.

♦ List the maximum, minimum and average salary in the company.

♦ List the maximum salary paid to a salesman.

RELATIONAL DATABASE MANAGEMENT SYSTEM 18

ASSIGNMENT 14 : DATA RETRIEVAL

Page 19: RDBMS Lab Guide

LA

B G

UI

DE

DAY 4 ASSIGNMENTS

Perform the following queries against EMPLOYEE and DEPARTMENT tables:

♦ List the number of employees and average salary for employees in department 20.

♦ List name, salary and PF amount of all employees. (PF is calculated as 10% of basic

salary)

♦ List names of employees who are more than 2 years old in the company.

♦ List the employee details in the ascending order of their basic salary.

♦ List the employee name and hire date in the descending order of the hire date.

♦ List employee name, salary, PF, HRA, DA and gross; order the results in the

ascending order of gross. HRA is 50% of the salary and DA is 30% of the salary.

♦ List the department numbers and number of employees in each department.

♦ List the department number and total salary payable in each department.

♦ List the jobs and number of employees in each job. The result should be in the

descending order of the number of employees.

♦ List the total salary, maximum and minimum salary and average salary of the

employees jobwise.

♦ List the total salary, maximum and minimum salary and average salary of the

employees, for department 20.

♦ List the average salary of the employees job wise, for department 20 and display

only those rows having an average salary > 1000

RELATIONAL DATABASE MANAGEMENT SYSTEM 19

ASSIGNMENT 15 : DATA RETRIEVAL

Page 20: RDBMS Lab Guide

LA

B G

UI

DE

DAY 4 ASSIGNMENTS

The following questions pertain to a database with the following tables.

Suppliers

Parts

Projects

Shipment

S# SName Status City

S1 Smith 20 London

S2 Jones 10 Paris

S3 Blake 30 Paris

S4 Clark 20 London

S5 Adams 30 Athens

P# PName Color Weight City P1 Nut Red 12.0 London P2 Bolt Green 17.0 Paris

P3 Screw Blue 17.0 Rome P4 Screw Red 14.0 London

P5 Cam Blue 12.0 Paris P6 Cog Red 19.0 London

J# Jname City

J1 Montago London

J2 Cat Paris

J3 Box London

J4 Montago Rome

J5 Eagles Athens

RELATIONAL DATABASE MANAGEMENT SYSTEM 20

ASSIGNMENT 16 : DATA RETRIEVAL

S# P# J# Qty

S1 P1 J1 350

S1 P3 J3 120

S2 P1 J1 620

S3 P2 J3 700

S2 P2 J4 250

S4 P3 J2 125

S5 P4 J2 325

Page 21: RDBMS Lab Guide

LA

B G

UI

DE

DAY 4 ASSIGNMENTS

The significance of an SPJ record is that the specified supplier supplies the specified part to the specified project in the specified quantity (and the combination S#-P#-J# uniquely identifies such a record).

♦ Get full details of all projects in London.

♦ Get S# for suppliers who supply project J1.

♦ Get all part-color/part-city combinations.

♦ Get all S#/P#/J# triples such that all are co-located.

♦ Get al S#, P#, J# triples such that they are not all co-located.

♦ Get P# for parts supplied by a supplier in London.

♦ Get all pairs of cities such that a supplier in the first city supplies to a Project in the

second city.

♦ Get J# for projects supplied by at least one supplier not in the same city.

♦ Get all pairs of part numbers such that some supplier supplies both the indicated

parts.

♦ Get the total quantity of part P1 supplied by S1.

♦ For each part supplied to a project, get the P#, J# and corresponding total quantity.

♦ Get P# of parts supplied to some project in an average quantity > 320.

♦ Get project names for projects supplied by supplier S1.

♦ Get colors of parts supplied by S1.

♦ Get J# for projects using at least one part available from supplier S1.

♦ Get supplier numbers for suppliers supplying at least one part supplied by at least

one supplier who supplies at least one red part.

♦ Get supplier numbers for suppliers with a status lower than that of supplier S1.

♦ Get project numbers for projects not supplied with any red part by any London

supplier.

RELATIONAL DATABASE MANAGEMENT SYSTEM 21

ASSIGNMENT 16 : DATA RETRIEVAL

Page 22: RDBMS Lab Guide

LA

B G

UI

DE

DAY 5 ASSIGNMENTS

Now solve the following set of queries according to given schema: Write the SQL commands to create a database schema for the following relational schema:

CUSTOMER (CUST_ID, CUST_NAME, ANNUAL_REVENUE, CUST_TYPE) CUST_ID must be between 100 and 10,000 ANNUAL_REVENUE defaults to $20,000 CUST_TYPE must be manufacturer, wholesaler, or retailer

Data for CUSTOMER table

RELATIONAL DATABASE MANAGEMENT SYSTEM 22

ASSIGNMENT 16 : DATA RETRIEVAL

CUST_ID CUST_NAME ANNUAL_REVENUE CUST_TYPE

100 Revathi 1000000 manufacturer

101 Richa 1800000 wholesaler

102 Rishi 1000000 retailer

103 Rijesh 4000000 wholesaler

104 Kalyan 4800000 Wholesaler

311 Karthik 5500000 retailer

Page 23: RDBMS Lab Guide

LA

B G

UI

DE

DAY 5 ASSIGNMENTS

SHIPMENT (SHIPMENT_#, CUST_ID, WEIGHT, TRUCK_#, DESTINATION, SHIP_DATE) Foreign Key: CUST_ID REFERENCES CUSTOMER, on deletion cascade Foreign Key: TRUCK_# REFERENCES TRUCK, on deletion set to null Foreign Key: DESTINATION REFERENCES CITY, on deletion set to null WEIGHT must be under 1000 and defaults to 10

Data for SHIPMENT table

RELATIONAL DATABASE MANAGEMENT SYSTEM 23

ASSIGNMENT 16 : DATA RETRIEVAL

SHIPMENT_# CUST_ID WEIGHT TRUCK_# DESTINATION SHIP_DATE

100 100 500 100 London Null

101 101 100 102 Paris Null

102 101 300 103 London Null

103 101 10 102 Panama City 12-Dec-03

104 101 20 101 Los Angeles Null

105 102 200 102 Rome Null

106 100 50 101 Sioux City 18-Sep-03

107 104 500 100 Manhattan Null

108 103 50 103 San Francisco Null

109 104 25 101 San Francisco Null

110 102 200 103 London 11-Oct-98

111 103 100 101 London 09-Sep-99

112 104 500 100 London 18-Jun-88

113 104 200 100 London 11-Oct-98

114 104 50 103 Manhattan 29-May-03

115 100 75 103 Los Angeles 17-Sep-02

116 101 55 102 Baltimore 01ul-02

117 103 45 101 Paris Null

118 103 45 100 Rome Null

119 103 45 102 Los Angeles Null

120 104 45 102 London Null

121 100 150 102 Sioux City Null

122 101 500 102 Manhattan Null

123 102 250 102 San Francisco 31-Jul-02

124 311 0.5 102 Denver Null

125 311 100 102 St. Louis Null

Page 24: RDBMS Lab Guide

LA

B G

UI

DE

DAY 5 ASSIGNMENTS

TRUCK (TRUCK_#, DRIVER_NAME)

Data for TRUCK table

CITY (CITY_NAME, POPULATION )

Data for CITY table

RELATIONAL DATABASE MANAGEMENT SYSTEM 24

ASSIGNMENT 16 : DATA RETRIEVAL

TRUCK_# DRIVER_NAME

100 Jensen

101 Sasi

102 Hrithik

103 Jake Stinson

CITY_NAME POPULATION

London 100000000

Paris 120000000

Rome 200000000

Panama City 1230000000

San Francisco 20000000

Sioux City 5000000000

Manhattan 10000000

Los Angeles 7000

Baltimore 2000

Denver 1000

St. Louis 5000

Page 25: RDBMS Lab Guide

LA

B G

UI

DE

DAY 5 ASSIGNMENTS

Perform the following queries:

♦ What are the names of customers who have sent packages (shipments) to Sioux City?

♦ To what destinations have companies with revenue less than $1 million sent pack-

ages?

♦ What are the names and populations of cities that have received shipments weighing

over 100 pounds?

♦ Who are the customers having over $5 million in annual revenue who have sent ship-

ments weighing less than 1 pound?

♦ Who are the customers having over $5 million in annual revenue who have sent ship-

ments weighing less than 1 pound or have sent a shipment to San Francisco?

♦ Who are the drivers who have delivered shipments for customers with annual reve-

nue over $20 million to cities with populations over 1 million?

♦ List the cities that have received shipments from customers having over $15 million

in annual revenue.

♦ List the names of drivers who have delivered shipments weighing over 100 pounds.

♦ List the name and annual revenue of customers who have sent shipments weighing

over 100 pounds.

♦ List the name and annual revenue of customers whose shipments have been deliv-

ered by truck driver Jensen.

♦ List customers who had shipments delivered by every truck. ( use NOT EXISTS)

♦ List cities that have received shipments from every customer. ( use NOT EXISTS)

♦ List drivers who have delivered shipments to every city. (use NOT EXISTS)

RELATIONAL DATABASE MANAGEMENT SYSTEM 25

ASSIGNMENT 16 : DATA RETRIEVAL

Page 26: RDBMS Lab Guide

LA

B G

UI

DE

DAY 5 ASSIGNMENTS

♦ Customers who are manufacturers or have sent a package to St. Louis.

♦ Cities of population over 1 million which have received a 100-pound package

From customer 311.

♦ Trucks driven by Jake Stinson which have never delivered a shipment to Denver.

♦ Customers with annual revenue over $10 million which have sent packages under

1 pound to cities with population less than 10,000.

♦ Create views for each of the following:

♦ Customers with annual revenue under $1 million.

♦ Customers with annual revenue between $1 million and $5 million.

♦ Customers with annual revenue over $5 million.

♦ Use these views to answer the following queries:

♦ Which drivers have taken shipments to Los Angeles for customers with

revenue over $5 million?

♦ What are the populations of cities which have received shipments from

customers with revenue between $1 million and $5 million?

♦ Which drivers have taken shipments to cities for customers with revenue

under $1 million, and what are the populations of those cities?

RELATIONAL DATABASE MANAGEMENT SYSTEM 26

ASSIGNMENT 16 : DATA RETRIEVAL

Page 27: RDBMS Lab Guide

LA

B G

UI

DE

DAY 6 ASSIGNMENTS

PerfectPets is a practice that provides private health care for domestic pets throughout America. This service is provided through various clinics located in the main cities of America. The Director of Perfect Pets is concerned that there is a lack of communication between organizations and particularly in the sharing of information and resources across the various clinics. To resolve this problem the Director has requested the creation of a centralized database system to assist in the more effective and efficient running of the clinics. The re-lational schema for the PerfectPets database looks as fol-lows: (Abbreviation in the following charts: pk means primary key, fk means foreign key, pk1/pk2/pk3 means 1st/2nd/3rd component of a primary key)

RELATIONAL DATABASE MANAGEMENT SYSTEM 27

COMPREHENSIVE CASE STUDY - 1

Page 28: RDBMS Lab Guide

LA

B G

UI

DE

DAY 6 ASSIGNMENTS

RELATIONAL DATABASE MANAGEMENT SYSTEM 28

COMPREHENSIVE CASE STUDY - 1

Page 29: RDBMS Lab Guide

LA

B G

UI

DE

DAY 6 ASSIGNMENTS

COMPLETE THE FOLLOWING TASKS:

a. List the name and type of all pets.

b. Find the name and type for every pet that has been registered during the year 2001. c. Give the name of the staff member who is not a manager and receives the highest

salary. d. List the name of every staff member who receives the salary higher than the average

salary of the company.

e. Give the average number of days for pet treatment. f. For every clinic, list clinic number, city, and state along with the pen number and pen

status for each clinic. g. List staff’s first and last name for all staffs who manages clinic(s) that are located in

the city “Brea”.

h. List the name (first and last) of every owner who owns “Chihuahua”. i. List the name of every owner who owns a pet that has visited a clinic located in the

city “Fullerton”. j. List the name and type of pet for every pet that has been treated more than 2 days

and spent more than $100 for treatment. k. List the staff’s first name and last name for all staffs who are managers but do not

manage any clinic (e.g., the position is manager). l. List the name (first and last) pet owner who made an appointment for his/her pet but

did not bring it to any clinic (e.g., no record of examination or treatment).

m. Find the name and type of pet that has received the most expensive treatment. n. Find the busiest registration month for pet in the past. We assume that the more pets

are registered, the busier the month is. o. List the name and type for every pet, along with its owner’s last name. If a pet does

not have an owner, display ‘lost pet’ instead.

p. Find the average cost of treatment for each type of pet?

q. List the name (first and last) of every pet owner who owns more than one pet. r. List the name of every drug and its current stock that need to be re-ordered. A drug

needs to be re-ordered when the quantity in stock is less than the quantity of re-order

level. Sort the result by the quantity in stock. s. Find the clinic number that has the least amount of drug value (e.g., a drug value is

computed as drug cost * quantity in stock) in its pharmacy stock. t. List the city (e.g., for pet owners) and the total amount of cost spent for pet

treatment in each city.

u. List the clinic number, phone number, and its city that has all kinds of drugs available

in its stock.

————> PAPER SUBMISSION

RELATIONAL DATABASE MANAGEMENT SYSTEM 29

COMPREHENSIVE CASE STUDY - 1

Page 30: RDBMS Lab Guide

LA

B G

UI

DE

DAY 6 ASSIGNMENTS

Given the Schema :

Trainer

Course_Details

RELATIONAL DATABASE MANAGEMENT SYSTEM 30

COMPREHENSIVE CASE STUDY - 2

TrainerID TraineeName EmailID Phone

1 Abraham [email protected] 9844499999

2 Boyce [email protected] 9844499989

3 Camilla [email protected] 9844499997

4 Davis [email protected] 9844499996

5 Elsa [email protected] 9844499499

6 Ferguson [email protected] 9844409999

7 Abraham [email protected] 9844459999

8 Gordon [email protected] 9844996999

9 Hilton [email protected] 9899677999

10 Boyce [email protected] 9877788999

11 Zenith [email protected] 9869977799

12 Abraham [email protected] null

CourseID CourseName

GPF Programming Fundamentals

GDB Relational Database Management System

ODB Oracle 8i

OVB Visual Basic

JJA Java

JAJ Advanced Java

DNT Introduction to DotNot Technology

DCS Programming in C#

DDB SQL Server 2000

MDB DB2

MCS CICS

Page 31: RDBMS Lab Guide

LA

B G

UI

DE

DAY 6 ASSIGNMENTS

Batch_Schedule

RELATIONAL DATABASE MANAGEMENT SYSTEM 31

COMPREHENSIVE CASE STUDY - 2

BatchName CourseID Start_Date End_Date

Batch1 GPF 10-JAN-2007 20-JAN-2007

Batch1 GDB 21-JAN-2007 31-JAN-2007

Batch1 ODB 1-JEB-2007 20-FEB-2007

Batch1 OVB 21-FEB-2007 28-FEB-2007

Batch2 GPF 10-JAN-2007 20-JAN-2007

Batch2 GDB 21-JAN-2007 31-JAN-2007

Batch2 DNT 1-FEB-2007 10-FEB-2007

Batch2 DCS 2-FEB-2007 15-FEB-2007

Batch2 DDB 16-FEB-2007 22-FEB-2007

Batch3 GDB 25-JAN-2007 02-FEB-2007

Batch3 JJA 3-FEB-2007 20-FEB-2007

Batch3 JAJ 21-FEB-2007 28-FEB-2007

Batch4 GPF 1-FEB-2007 11-FEB-2007

Batch4 GDB 12-FEB-2007 22-FEB-2007

Batch4 MDB 23-FEB-2007 28-FEB-2007

Batch4 MCS 1-MAR-2007 15-MAR-2007

Page 32: RDBMS Lab Guide

LA

B G

UI

DE

DAY 6 ASSIGNMENTS

Feedback

RELATIONAL DATABASE MANAGEMENT SYSTEM 32

COMPREHENSIVE CASE STUDY - 2

TrainerID CourseID BatchName FBRate

12 GPF Batch1 4.18

11 GPF Batch1 4.65

2 GDB Batch1 4.51

12 GDB Batch1 4.68

12 GPF Batch2 4.28

1 GPF Batch2 4.28

12 ODB Batch1 4.32

12 OVB Batch1 4.08

12 MDB Batch4 4.12

12 MCS Batch4 4.08

12 JAJ Batch3 4.12

12 DNT Batch2 4.12

12 DDB Batch2 4.12

12 DCS Batch2 4.08

12 JJA Batch3 4.67

2 GDB Batch2 4.61

2 GDB Batch3 4.41

2 GDB Batch4 4.52

Page 33: RDBMS Lab Guide

LA

B G

UI

DE

DAY 6 ASSIGNMENTS

COMPLETE THE FOLLOWING TASKS:

♦ List the name of all the courses handled by each trainer

The output should be <trainername> <coursename>

♦ List the name of trainers who have handled more than one course

♦ List the trainer id, name of trainers and the number of different courses handled

♦ Get the complete training duration for each batch

♦ Get the course details and trainer details for each batch as on 20 feb 2007.

♦ List the id of trainers who have handled more than one course for a batch along with

the batch name

♦ List the trainers who have handled all the courses for a batch

RELATIONAL DATABASE MANAGEMENT SYSTEM 33

COMPREHENSIVE CASE STUDY - 2