You are on page 1of 8

Welcome Back !

Hope you enjoyed the Happy Holi and long semester break –Good, now get back to work…

ASSIGNMENT 14 WEEK 9 LAB A and B [28/03/2011 TO 02/04/2011]/Marks 90


EVALUATION DATE WEEK 10 [04/04/2011-09/04/2011] LAB A Q1 AND LAB B Q2 AND 3

NOTE <Codes, UML and ER Diagram should be neatly written and drawn on Paper with name and
enrollment no at top, Project Title and strictly no Software/Editor usage--and to be done individually in
lab not group-wise>. This has to be shown to lab teacher only at evaluation date.

Question 1. Analyze the current project. Now Make a Draft of your Project on similar 6 points
writing code and Diagrams wherever necessary using OOSP Concepts, this work will be
incremented by ongoing lectures and labs[Normalization and Connectivity Topics to be
attended with Ongoing Lectures done in class i.e. will be covered in lecture this week but has to
be completed by evaluation date]. The topics here to be referred are given. But these 6 Points
should be clearly mapped with your Project Domain. Draft -1 will consist of Q1, 2 and
Q3part B> You can refer DBMS Validation and Verification Questions given in T2 Question
Paper or old DBMS Labs.
TDD APPROACH: Write your Verification and Validation Codes on those formats using Joins,
Nested Queries, Advances Select, User and System Defined EXCEPTIONS.

Example Case Study: The Cafeteria Information system:


1. Single application: single class, single function.
Class: Cafeteria
Function: Food_Zone
Attributes:
Cafeteria::Food_Zone: Menu_card,Bill

2. Single application: single class, multiple functions.


Class: Cafeteria
Function: Food_Zone, Customer_Record, Staff_Record
Attributes:
Cafeteria:: Food_Zone: Menu_card, Bill
Cafeteria:: Customer_Record: customer_name,customer_bday
Cafeteria:: Staff_Record: staff_id, staff_name, staff_record

3. Single application: multiple classes, multiple functions, simple relation.


Class: Cafeteria, Customer
Function:
Cafeteria: Parking, Staff_Record, Menu
Customer: Customer_Record
Attributes:
Cafeteria:: Parking:p_type
Cafeteria:: Menu:bill
Cafeteria:: staff_record: staff_id, staff_name,staff_job
Customer:: Customer_Record: cutomer_name, cutomer_bdate

OOSP Concepts: TDD Approach: Validation of variables in methods, Casting for formats
ex: bdate format, name is string, staff id in integer, parking can be filled in 2 types, non
vegItems present in menu or not etc.

4. Single application with persistent data: multiple classes, multiple functions, simple class
relation, multiple data table.
Class: Cafeteria, Customer
Function:
Cafeteria: Parking, Staff_Record, Menu
Customer: Customer_Record
Attributes:
Cafeteria:: Parking:p_type
Cafeteria:: Menu:bill
Cafeteria:: staff_record: staff_id, staff_name,staff_job
Customer:: Customer_Record: cutomer_name, cutomer_bdate

OOSP Concepts: OO Concepts: Objects, Classes, Inner classes, Methods, Constructors, Static
member functions , Wrapper Classes, Packages and Interfaces and Garbage collection +
Introduction to RDBMS, create table, simple create,insert, select.= [1,2,3,4]
DBMS Tables for the same,Create Data, INSERT Data AND select //simple sql
TDD Approach=Simple Select + Simple Exception Handling

5. Single application with persistent data: multiple classes, multiple functions, complex class
relation (inheritance), multiple data table.
Class: Cafeteria, Customer
Function:
Cafeteria: Parking, Staff_Record, Menu
Customer: Customer_Record
Attributes:
Cafeteria:: Parking:p_type
Cafeteria:: Menu:bill
Cafeteria:: staff_record: staff_id, staff_name,staff_job
Customer:: Customer_Record: cutomer_name, cutomer_bdate

OOSP Concepts: Inheritance+ Software Development Life Cycle Models


DBMS Tables for the same, ADVANCED SQL::Create Data, INSERT Data AND select For
TDD Approach //Advanced sql-NESTED –part 1+Normalization
TDD Approach=Adv. Select + User Defined /System Defined Exception Handling

6. Single application with persistent data: multiple classes, multiple functions, complex class
relation (polymorphism), multiple data table.

OOSP Concepts: Polymorphism+ System Analysis and Design Methodologies, UML (Object
diagram, Class diagram-(Part of Q2 so attend in Q2 Only)+Connecting with simple access
table+DBMS Tables for the same i.e. INSERT Data, Create Data //Advanced sql-JOINS-part
2 +ER i.e. Entity Relationship Diagram (Part of Q3 so attend in Q3 Only)+
TDD Approach=Adv. Select + User Defined /System Defined Exception Handling

Question 2. Most of your project UML’S have errors so rectify and make a Draft of all
UML’S for your Project Use Cases as Lab Assignment
1. Use Case
2. Activity
3. Sequence
4. Class and Object Diagram
5. Collaboration
6. Component. ( To be submitted with the final report)
7. Deployment.( To be submitted with the final report)
Q3 A>Consider the following information about a university database:
• Professors have an SSN, a name, an age, a rank, and a research specialty.
• Projects have a project number, a sponsor name (e.g., NSF), a starting date, an
ending date, and a budget.
• Graduate students have an SSN, a name, an age, and a degree program (e.g., M.S.
or Ph.D.).
• Each project is managed by one professor (known as the project’s principal
investigator).
• Each project is worked on by one or more professors (known as the project’s
co-investigators).
• Professors can manage and/or work on multiple projects.
• Each project is worked on by one or more graduate students (known as the
project’s research assistants).
• When graduate students work on a project, a professor must supervise their work
on the project. Graduate students can work on multiple projects, in which case
they will have a (potentially different) supervisor for each one.
• Departments have a department number, a department name, and a main office.
• Departments have a professor (known as the chairman) who runs the department.
• Professors work in one or more departments, and for each department that they
work in, a time percentage is associated with their job.
• Graduate students have one major department in which they are working on their
degree.
• Each graduate student has another, more senior graduate student (known as a
student advisor) who advises him or her on what courses to take.

Design and draw an ER diagram that captures the information about the university.
Use only the basic ER model here; that is, entities, relationships, and attributes. Be
sure to indicate any key and participation constraints.

Question 3 B>Now make Advance ER-Diagram for your project.


ASSIGNMENT 15 and 16 WEEK 10 LAB A and B [4/04/2011 TO 09/04/2011]/Marks 100
EVALUATION DATE WEEK 10 [11/04/2011-16/04/2011] LAB A Q1-4 AND LAB B Q4-8.

Question 1>Create the following tables for a COMPANY DATABASE, Normalize the data till
BCNF AND ASNWER FOLLOWING QUESTIONS.

EMPLOYEE(EmployeeId,Lname,Fname,PoisitionId,Supervisor,Hiredate
,Salary,Commission,Deptid,Qualid,DOB) (DOB>25)
DEPENDENT(EmployeeId,Dependentid,DepDOB,Relation)
POSITION(Positionid,PosDesc)
DEPT(Deptid,DeptName,Location,Employeeid)
QUALIFICATION(Qualid,Qualdesc)
EMPLEVEL(Levelno,Lowsalary,Highsalary)

1. Display all employee names (last name and first name separated by a
comma and a space) with proper case.
2. Display all employees with their commission value. Display 0 commission
for employees who do not get any commission.
3. Count the total number of employees in 1 department pertaining to 1 LOCATION.
4. Count the distinct Department names in LOCATION.
5. Display all Employees date of joining and their total yr of exp in company.
6. Find the average, highest, and lowest age for Employees.
7. Display the total number of dependents for each employee for employees
who have at least two dependents.
8. Display only the year value from each employee’s hire date.
9. Find average employee commission. (a) Ignore nulls. (b) Do not ignore
nulls.
10. Find sum of Maximum count by term by DEPARTMENT EXCELLING SALES AMOUNT
1 LAKH. (GROUP BY two columns)
11. Count number of EMPLOYEE members by each department.
13.Display average employee salary by department, but do no include
departments with average salary less than $75,000.
14.Find number of years employees have been working for. Display integer
part of value only.
15. Find Employees recruited in the month of May.
16. Display employee’s last name and first name, followed by
salary+commission if commission is not null, else display salary only.
17. Display employee’s full name followed by a message based on salary. If
salary is above $100,000, display “HIGH”. If salary is between $50,000 and
$100,000, display “MEDIUM”. If salary is below $50,000, display “LOW”.

Question 2>Normalize the Unormalized tables:

Student# Advisor Adv-Room Class1 Class2 Class3


1022 Jones 412 101-07 143-01 159-02
4123 Smith 216 201-01 211-02 214-01
Question 3>Show a logical design in at least 3NF using the information given for the following
situation:
- Doctors can have many patients.
- Patients can have several doctors.
- Each doctor can have several specialties.
- One insurance policy can cover several people.
- Each patient has a name, address, place of employment, age, and insurance policy.
- Each patient can have several illnesses.
- Each doctor has a name, address, and a specialty.
- Two doctors can have the same name.
- Two patients can have the same name.
- Patients under 18 must have an adult who is responsible for them.
- One of the frequent requests for data is from users who need to know all of the doctors with a
certain specialty.

Question 4> For all the two cases given below attend (i) and (ii)

Case 1:
Case 2:

Question 5> Find the relational tables, their primary and foreign keys corresponding to
the following E-R diagrams. Write the corresponding SQL DDL for each relation.
Question 6> Consider the following relation
patients (pnum, pname, age)
doctors (dnum, dname, rank, phone)
visits (pnum, dnum, date, diagnosis)

Write SQL for the following:


(Simple selection and projection)
i. Who are the patients 10 years old or younger?
ii. List details of the surgeons
iii. What are the phone numbers of doctors?

(Set Operation)
i. Find all the patients who saw doctor 801 but not 802 (i.e. dnum=801, dnum ≠ 802)

(Join)
i. Who are the surgeons who visited the patient 101 (i.e. pnum = 101)?
ii. Is there any non-surgeon doctors who performed a surgeon (a doctor performed a
surgeon if the visit
record shows diagnosis=”operation” for him)?

(Division)
i Who has seen all the surgeons in the past two months?

Question 7: Answer the following”

1. Given relation R(A,B,C,D,E) with dependencies


ABC
CDE
DEE
Is AB a candidate key of relation R ?
Is ABD a candidate key of relation R ?

2. Consider the universal relation R = {A, B, C, D, E, F, G, H, I,J} and the set of


functional dependencies FD =
{ {A, B}  {C}, {A}  {D, E}, {B}  {F}, {F} {G, H}, {D}  {I, J} }.
What is the key for R?

3. Consider the universal relation R = {A, B, C, D, E, F, G, H, I,J} for the following


different set of functional dependencies FD =
G = { {A, B}  {C}, {B, D}  {E, F}, {A, D}  {G, H}, {A}  {I}, {H} 
{J} }.What is the key for R?

4. Compute the closure of the following set F of functional dependencies for relation
schema R = (A, B, C, D, E).
A BC
CD E
BD
EA
List all the candidate keys of relation R.

Question 8:
Q1. Decompose the given below relation R up to BCNF relations.

filmNo actorNo role fTitle dirNo director aName timeOnScreen

fd1

fd2

fd3

fd4

Q2. Decompose the given below relation R up to BCNF relations

carReg hireDate make model custNo custName outletNo outletLoc

fd1

fd2

fd3

fd4

fd5

You might also like