WORKED EXAMPLES ON LOGICAL DATABASE DESIGN.

LOGICAL DATABASE DESIGN

WORKED EXAMPLES

8.1 What is an entity? Give examples of entities.

Entities specify distinct real world items, in an application, e.g., employees, books, cars, fan, chair etc .

8.2 In what ways is an attribute different from an entity?

Attributes are specific properties of entities. For example, the attributes of the entity car is (Registration no., chassis no., engine no., h.p., no. of seats, model, manufacturer).

8.3 What do you understand by a 1 to 1, 1 to many, many to many relationships?

Give an example for each.

If for every value of an attribute A in a relation there is a unique value of an attribute B in another relation then A and B are dependent 1 to 1.

If for each A there are N values of B, then A and B are 1:N.

Finally if for each value of A there are M values of B and for each B there are N values of A, then A and B are M:N related.

image

8.4 What is the difference between a relation and a relationship?

Relationship depicts the dependency or connection between two entities. A relation is a flat table.

8.5 What is normalization of a relation?

Normalization is a procedure used to transform a set of relations into another set which has the following desirable properties:

1. Duplication of data in database is minimized.

2. Operations of adding, deleting, modifying data in a database do not lead to inconsistent data in database.

3. Retrieval of data is simplified

8.6 Why should relations be normalized?

Normalization ensures that data in the database are not unnecessarily duplicated. It also ensures that addition and deletion of entity rows(or tuples) or change of individual attribute values do not lead to accidental loss of data or errors in database. Normalization also simplifies retrieval of data from a database.

8.7 What is functional dependency?

Let X and Y be two attributes of a relation. Given a value of X, if there is only one value of Y corresponding to it then Y is functionally dependent on X.

8.8 What is the key attribute in a relation?

If an attribute X in a relation is such that the value of all the other attributes are uniquely determined by the value of X, then X is the key attribute of the relation.

8.9 What is the difference between a 2 NF and a 3 NF relation?

In 2 NF all non-key attributes are dependent on the key attribute. No non-key attribute should be dependent in a part of a composite key. There may be a dependency between non-key attributes. Such a dependency is not allowed in 3 NF relation.

8.10 When is BCNF required?

If there is a dependency between attributes of two overlapping multi-attribute keys the relation needs to be normalized to BCNF. It implies that a relation needing BCNF has more than one candidate key.

8.11 When are 4 NF and 5 NF required?

When there is more than 1 independent multi-valued dependency between attributes in a relation then 4 NF and 5 NF are required.

8.12 What is the difference between 4 NF and 5 NF?

5 NF adds one more relation with attributes which have multi-valued dependency in the 4 NF relation.

8.13 Develop E-R diagram for the following:

(i)Customer withdraws money from his account.

(ii)Students write examinations.

(iii) Students attend classes.

(iv)Professors write books.

(v)Driver drives a car.

image

8.14 For Question 8.13, obtain relations for each entity. Normalize the relations

(i) CUSTOMER (A/c no., name, address, type of account) WITHDRAW (A/c no., amount withdrawn, date) ACCOUNT (A/c no., A/c type, balance amount)

(ii) STUDENT (Roll no., name, address, dept., year)

WRITES EXAM (Roll no., subject no., exam date, attempt no.) SUBJECT (Subject no., name, taught in sem., pre-requisites)

(iii) STUDENT (Roll no., name, address, dept., year) ATTENDS (Roll no., course no., semester, calendar year)

CLASSES (course no., teacher id., time of class, location of class)

(iv) PROFESSOR (Professor id., name, address, affiliation)

(Affiliation gives the University he is working in and the department in that University)

WRITES (Professor id., book id., book name, year written)

BOOKS (Book id., book name, authors, publisher, no. of pages, price, year of publication)

(book id. Is standardized as ISBN no. in India)

(v) DRIVER (License no., name, address, type, validity, date of license) DRIVES (License no., registration no.)

CAR (Registration no., manufacturer, model, year, horse power, chassis no., body no., no. of seats)

Relations (i), (ii), (iv) are already in normal form.

Relation (iii) has multi-valued dependency if we assume that

a course may be taught by many teachers

a teacher can teach many courses

a student may attend many courses

We should add relations

TEACHER-COURSE (Teacher id., course no., roll no.)

In relation (v), non-key attributes are dependent in the relation CAR as given manufacturer and model of car, the horse power is known. We thus split CAR into two relations as shown:

(i) CAR REGISTRATION(Registration no., manufacturer, model, year, chassis no., body no. )

(ii) CAR PARTICULARS(Manufacturer, model, year, horse power, no. of seats)

8.15 For the following word statement, obtain E-R diagram and relations. Use any reasonable assumptions. “A machine shop produces many parts which it takes on contract. It employs many machinists who operate any of the machines. A part needs working on only one machine. A record is kept on the quantity of material needed for producing each part. The production of each part is tracked by giving a job number, start time and end time and machinist identification.”

PART(Part no., part name, material type, qty. needed)

PART-MACHINE(Part no., machine no., time needed on machine)

MACHINE(Machine no., machine name, details of machine)

MACHINISTS(Machinist id., name, wage)

MACHINE ASSIGNMENT(Machine no., machinist no., part no., start time, end time)

image

8.16 Admission procedure in a university is as follows:

An advertisement is issued giving essential qualifications for the course, the last date for receipt of application, and the fee to be enclosed with the application. A clerk in the registrar’s office checks the received applications to see if marksheet and fee are enclosed and sends valid applications to the concerned academic department. The department checks the application in detail and decides the applicants to be admitted, those to be put in the waiting list, and those rejected. Appropriate letters are sent to the Registrar’s office which intimates the applicant. Obtain an E-R diagram and a set of relations for the above problem statement.

Assumptions:

1. An applicant sends separate applications for each course.

2. A clerk (or case worker) in Registrar’s office verifies several applications

3. Several case workers are there in Registrar’s office

4. The department has only one person who decides the result on scrutiny of application

APPLICANT(Applicant no., Applicant name, address)

SENDS(Applicant no., Application no.)

APPLICATION(Application no., dept no., fee paid, marks)

APPLICATION-SCRUTINY(Application no., dept no.)

DEPARTMENT(Dept no., Dept name, no. of student)

APPLICATION-REPLY(Application no., dept no., admit)

image

8.17 A magazine is published monthly and is sent by post to its subscribers. Two months before the expiry of subscription, a reminder is sent to the subscribers. If subscription is not received within a month, another reminder is sent. If renewal subscription is not received up to two weeks before the expiry of the subscription, the subscriber’s name is removed from the mailing list and the subscriber informed. Obtain an E-R diagram and relations for the above problem statement.

SENT TO(Rem. Id., subscriber id., date due, amount due)

REMINDER(Rem. Id., reminder no, date due) Can be merged as 1:1 relationship given below:

REMINDER(Rem. Id., subscriber id.,reminder no, date due, amount due)

SUBSCRIBER(Subscriber id., name, address, subscription expiry date) SUBSCRIBER-PAYMENT(Subscriber no., cheque no., date, amount received)

image

8.18 What are the advantages and disadvantages of systems using separate Data files?

Main advantage is efficiency. Individual applications can be efficiently implemented using minimal storage and processing time. Disadvantages of using individual files for applications are listed in summary points 16,17,18 and 19.

8.19 What do you understand by the term data integrity?

If a data field is stored in different files with different values there is no data integrity. For example, if a student’s address in the department’s file is different from that in the hostel file then there is no data integrity.

8.20Students’ records in a University are kept by various sections: Hostel, Health Centre, Academic Office, major departments, Accounts Section and Library.

If each of these sections maintains its own file-based system for processing, what problems do you foresee? Give examples.

Student’s identity number may be different in different files and it will be difficult to link them. If a student’s home address changes he should notify each section independently to change his address. If a management decision is taken that if a student’s hostel dues are not paid he will not be given grade card, it is difficult to implement this decision unless the information from hostel is sent to academic section. If the identification in hostel is different from that in academic office, then correlating the records would be very difficult. Stored data is redundant as it is repeated at many places.

8.21 What are the basic objectives in evolving a database for an organization?

Share data between applications. Minimize redundancy in data. Maintain consistency of data values. Protects data. Prevent unauthorized insertion, deletion and alteration of data. Ensure ready access to needed data.

8.22 What do you understand by the term data independence?

By data independence we mean that an application programmer need not know the physical format and storage of data to use the data in an application.

8.23 Distinguish between issues of privacy and security in a database?

Data security is concerned with protecting access to data. Authorization levels for updating, retrieving different data elements are specified. Protection against accidental loss of data is planned. Data privacy is concerned with preventing use of individual’s data without his/her permission.

8.24 What is the difference between a conceptual model and a logical model of a database?

A conceptual model of a database specifies the data needs for current and future applications. It also specifies the entities and relationships among entities. A logical data model formats the data as a relational model, hierarchical model or network model.

8.25 What is RDBMS?

In relational DBMS relations are used to represent the logical data model.

8.25 What are the responsibilities of a Database Administrator (DBA) in an organization?

A database administrator is responsible for ensuring integrity, security and privacy of data.

Comments

Popular posts from this blog

WORKED EXAMPLES ON PROCESS SPECIFICATION.

Why do we need information systems, management structure, requirements of information at different levels of management.

The User Interface:Establishing User Interfaces