KnowledgeBoat Logo
|

Computer Science

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

AttributeUCodeUNameUColor
ConstraintsPrimary KeyNot Null-

Table: COST

AttributeUCodeSizePrice
ConstraintsComposite Primary Key>0

Table: UNIFORM

UCodeUNameUColor
1ShirtWhite
2PantGrey
3SkirtGrey
4TieBlue
5SocksBlue
6BeltBlue

Table: COST

UCodeSizeCOST Price
1M500
1L580
1XL620
2M810
2L890
2XL940
3M770
3L830
3XL910
4S150
4L170
5S180
5L210
6M110
6L140
6XL160

(a) Can they insert the following tuples to the UNIFORM Relation ? Give reasons in support of your answer.

  1. 7, Handkerchief, NULL
  2. 4, Ribbon, Red
  3. 8, NULL, White

(b) Can they insert the following tuples to the COST Relation ? Give reasons in support of your answer.

  1. 7, S, 0
  2. 9, XL, 100

Relational Database

2 Likes

Answer

(a)

1. Tuple (7, Handkerchief, NULL): This tuple can be inserted because there is no constraint mentioned in the schema that prohibits NULL values for the UColor attribute.

2. Tuple (4, Ribbon, Red): This tuple can be inserted as all attributes have valid non-null values.

3. Tuple (8, NULL, White): This tuple cannot be inserted because UName attribute cannot be NULL as per the schema constraints.

(b)

1. Tuple (7, S, 0): This tuple cannot be inserted because the COST Price attribute must be greater than 0 as per the schema constraints.

2. Tuple (9, XL, 100): This tuple can be inserted as all attributes have valid values and the COST Price is greater than 0.

Answered By

1 Like


Related Questions