Computer Science
An organisation wants to create a database EMPDEPENDENT to maintain following details about its employees and their dependent.
EMPLOYEE(AadharNumber, Name, Address, Department, EmployeeID)
DEPENDENT(EmployeeID, DependentName, Relationship)
(a) Name the attributes of EMPLOYEE, which can be used as candidate keys.
(b) The company wants to retrieve details of dependent of a particular employee. Name the tables and the key which are required to retrieve this detail.
(c) What is the degree of EMPLOYEE and DEPENDENT relation?
Answer
(a) In the EMPLOYEE table, the attributes AadharNumber and EmployeeID can be used as candidate keys. This means that either AadharNumber or EmployeeID can uniquely identify each record in the EMPLOYEE table.
(b) The EMPLOYEE and DEPENDENT tables are linked using the EmployeeID key, which is utilized to retrieve details of dependents associated with a specific employee.
(c) In the EMPLOYEE relation, there are five attributes, resulting in a degree of 5. Similarly, the DEPENDENT relation has three attributes, making its degree 3.
Related Questions
In another class having 2 sections, the two respective class representatives have prepared 2 separate Sports Preferences tables, as shown below:
Sports preference of section 1 (arranged on roll number column)
Table: Sports Preferences
Roll_no Sports 9 Cricket 13 Football 17 Badminton 21 Hockey 24 Cricket Sports preference of section 2 (arranged on Sports name column, and column order is also different)
Table: Sports Preferences
Sports Roll_no Badminton 17 Cricket 9 Cricket 24 Football 13 Hockey 21 Are the states of both the relations equivalent? Justify.
The school canteen wants to maintain records of items available in the school canteen and generate bills when students purchase any item from the canteen. The school wants to create a canteen database to keep track of items in the canteen and the items purchased by students. Design a database by answering the following questions:
(a) To store each item name along with its price, what relation should be used? Decide appropriate attribute names along with their data type. Each item and its price should be stored only once. What restriction should be used while defining the relation ?
(b) In order to generate bill, we should know the quantity of an item purchased. Should this information be in a new relation or a part of the previous relation ? If a new relation is required, decide appropriate name and data type for attributes. Also, identify appropriate primary key and foreign key so that the following two restrictions are satisfied:
- The same bill cannot be generated for different orders.
- Bill can be generated only for available items in the canteen.
(c) The school wants to find out how many calories students intake when they order an item. In which relation should the attribute 'calories' be stored?
School uniform is available at M/s Sheetal Private Limited. They have maintained SCHOOL_UNIFORM Database with two relations viz. UNIFORM andCOST. The following figure shows database schema and its state.
School Uniform Database
Attributes and Constraints
Table: UNIFORM
Attribute UCode UName UColor Constraints Primary Key Not Null - Table: COST
Attribute UCode Size Price Constraints Composite Primary Key >0 Table: UNIFORM
UCode UName UColor 1 Shirt White 2 Pant Grey 3 Skirt Grey 4 Tie Blue 5 Socks Blue 6 Belt Blue Table: COST
UCode Size COST Price 1 M 500 1 L 580 1 XL 620 2 M 810 2 L 890 2 XL 940 3 M 770 3 L 830 3 XL 910 4 S 150 4 L 170 5 S 180 5 L 210 6 M 110 6 L 140 6 XL 160 (a) Can they insert the following tuples to the UNIFORM Relation ? Give reasons in support of your answer.
- 7, Handkerchief, NULL
- 4, Ribbon, Red
- 8, NULL, White
(b) Can they insert the following tuples to the COST Relation ? Give reasons in support of your answer.
- 7, S, 0
- 9, XL, 100
In a multiplex, movies are screened in different auditoriums. One movie can be shown in more than one auditorium. In order to maintain the record of movies, the multiplex maintains a relational database consisting of two relations viz. MOVIE and AUDI respectively as shown below :
Movie(Movie_ID, MovieName, ReleaseDate) Audi(AudiNo, Movie_ID, Seats, ScreenType, TicketPrice)(a) Is it correct to assign Movie_ID as the primary key in the MOVIE relation ? If no, then suggest an appropriate primary key.
(b) Is it correct to assign AudiNo as the primary key in the AUDI relation ? If no, then suggest appropriate primary key.
(c) Is there any foreign key in any of these relations ?