Simple SQL Queries - Refer to the question below CS2102 Exercise Il. (24 marks)
ID: 3756088 • Letter: S
Question
Simple SQL Queries - Refer to the question below
CS2102 Exercise Il. (24 marks) Consider the following self-describing schema. It is the schema of the database of an event organizer company. Prime attributes are underlined event (eid, ename, ecity) registration (cid, eid) customer (cid, cname, ccity) The table event stores the identifier, eid, the name, ename, of events organized by the company and the city ecity, where the event takes place. The primary key is feid he table customer stores the identifier, cid, the name, cname, of customers and the city where the customer lives, ccity. The primary key is (cid) The table registration stores the registrations of customers to event. The composite primary key is (cid, eid). Two referential integrity constraints on the table registration guarantee that the customer exists and that the event exists, respectively There can be events without registration and customers who have not registered to any event. In addition to the primary and foreign key constraints, no attribute is null. No constraint other than the above is enforced. For instance, there can be several events with the same name Consider that every foreign key constraint is annotated with ON UPDATE CASCADE and ON DELETE CASCADE Question 7. (2 marks) Which of the following operations never violates a constraint on the registration table? a) Insert a record into the registration table b) Delete a record from the registration table c) Update a record of the registration table d) All of the above e) None of the above Question 8. (2 marks) Which of the following operations may violate a FOREIGN KEY constraint on the registration table? a) Delete a record from the event table b) Delete a record from the customer table c) Update a record of the customer table d) All of the above e) None of the aboveExplanation / Answer
Question 7:
a) Insert a record into the registration table.---- violates a constraint as the corresponding customer id (cid) and event id(eid) should be inserted in the customer and event table.
b) Delete a record from the registration table.--- violates a foreign key constraint as the corresponding customer id (cid) and event id(eid) should be deleted from the customer and event table.
c) Update a record of the registration table --- violates a foreign key constraint as the corresponding customer id (cid) and event id(eid) should be updated from the customer and event table.
So correct answer is e) None of the above.
Question 8:
a) Delete a record from the event table --- may violate a foreign constraint as event can exist in registration table also.
b) Delete a record from the customer table --- may violate a foreign key constraint as customer can exist in registration table.
c) Update a record of the customer table --- may violates a foreign key constraint as customer details exists in the registration table also.
So correct answer is d) All of the above.
Do ask if any doubt. Please upvote.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.