Advertisements
Advertisements
Question
Define the term Domain with respect to RDBMS. Give one example to support your answer.
Solution
Domain is a set of values from which an attribute can take value in each row. For example, roll no field can have only integer values and so its domain is a set of integer values.
APPEARS IN
RELATED QUESTIONS
Give the term for the following:
Attribute that can uniquely identify the tuples in a relation.
Give the term for the following:
Special value that is stored when an actual data value is unknown for an attribute.
Give the term for the following:
An attribute that can uniquely identify tuples of the table but is not defined as the primary key of the table.
Differentiate between the Degree and cardinality of a relation.
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)
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)
Sports Preferences | |
Sports | Roll_no |
Badminton | 17 |
Cricket | 9 |
Cricket | 24 |
Football | 13 |
Hockey | 21 |
Are the states of both 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:
- 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?
- In order to generate a 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 relationship is required, decide the appropriate name and data type for attributes. Also, identify the appropriate primary key and foreign key so that the following two restrictions are satisfied:
i) The same bill cannot be generated for different orders.
ii) Bill can be generated only for available items in the canteen. - 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?
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 question:
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?
An organisation wants to create a database EMPDEPENDENT to maintain the following details about its employees and their dependent.
EMPLOYEE(AadharNumber, Name, Address, Department, EmployeeID)
DEPENDENT(EmployeeID, DependentName, Relationship)
What is the degree of EMPLOYEE and DEPENDENT relation?
School uniform is available at M/s Sheetal Private Limited. They have maintained SCHOOL_UNIFORM Database with two relations viz. UNIFORM and COST. The following figure shows the database schema and its state.
School Uniform Database | ||||||
Attributes and Constraints | Table: COST | |||||
Table: UNIFORM | UCode | Size | COST Price | |||
Attribute | UCode | UName | UColor | 1 | M | 500 |
Constraints | Primary Key | Not Nul | - | 1 | L | 580 |
Table: COST | 1 | XL | 620 | |||
Attribute | UCode | Size | Price | 2 | M | 810 |
Constraints | Composite Primary Key | >0 | 2 | L | 890 | |
Table: UNIFORM | 2 | XL | 940 | |||
UCode | UName | UColor | 3 | M | 770 | |
1 | Shirt | White | 3 | L | 830 | |
2 | Pant | Grey | 3 | XL | 910 | |
3 | Skirt | Grey | 4 | S | 150 | |
4 | Tie | Blue | 4 | L | 170 | |
5 | Socks | Blue | 5 | S | 180 | |
6 | Belt | Blue | 5 | L | 210 | |
6 | M | 110 | ||||
6 | L | 140 | ||||
6 | XL | 160 |
- Can they insert the following tuples to the UNIFORM Relation? Give reasons in support of your answer.
i) 7, Handkerchief, NULL
ii) 4, Ribbon, Red
iii) 8, NULL, White - Can they insert the following tuples to the COST Relation? Give reasons in support of your answer.
i) 7, S, 0
ii) 9, XL, 100
School uniform is available at M/s Sheetal Private Limited. They have maintained SCHOOL_UNIFORM Database with two relations viz. UNIFORM and COST. The following figure shows the database schema and its state.
School Uniform Database | ||||||
Attributes and Constraints | Table: COST | |||||
Table: UNIFORM | UCode | Size | COST Price | |||
Attribute | UCode | UName | UColor | 1 | M | 500 |
Constraints | Primary Key | Not Nul | - | 1 | L | 580 |
Table: COST | 1 | XL | 620 | |||
Attribute | UCode | Size | Price | 2 | M | 810 |
Constraints | Composite Primary Key | >0 | 2 | L | 890 | |
Table: UNIFORM | 2 | XL | 940 | |||
UCode | UName | UColor | 3 | M | 770 | |
1 | Shirt | White | 3 | L | 830 | |
2 | Pant | Grey | 3 | XL | 910 | |
3 | Skirt | Grey | 4 | S | 150 | |
4 | Tie | Blue | 4 | L | 170 | |
5 | Socks | Blue | 5 | S | 180 | |
6 | Belt | Blue | 5 | L | 210 | |
6 | M | 110 | ||||
6 | L | 140 | ||||
6 | XL | 160 |
Can they insert the following tuples to the COST Relation? Give reasons in support of your answer.
- 7, S, 0
- 9, XL, 100
Student Project Database | ||||
Table: STUDENT | ||||
Roll No | Name | Class | Section | Registration_ID |
11 | Mohan | XI | 1 | IP-101-15 |
12 | Sohan | XI | 2 | IP-104-15 |
21 | John | XII | 1 | CS-103-14 |
22 | Meena | XII | 2 | CS-101-14 |
23 | Juhi | XII | 2 | CS-101-10 |
Table: PROJECT | ||||
ProjectNo | PName | SubmissionDate | ||
101 | Airline Database | 12/01/2018 | ||
102 | Library Database | 12/01/2018 | ||
103 | Employee Database | 15/01/2018 | ||
104 | Student Database | 12/01/2018 | ||
105 | Inventory Database | 15/01/2018 | ||
106 | Railway Database | 15/01/2018 | ||
PROJECT ASSIGNED | ||||
Registration_ID | ProjectNo | |||
IP-101-15 | 101 | |||
IP-104-15 | 103 | |||
CS-103-14 | 102 | |||
CS-101-14 | 105 | |||
CS-101-10 | 104 |
For the above-given database STUDENT-PROJECT, can we perform the following operation?
Insert a record with registration ID IP-101-19 and ProjectNo 206 in the table PROJECT-ASSIGNED.
Given the following Tuple.
Tup = (10, 20, 30, 50)
Which of the following statements will result in an error?