Consider the following tables describing musical groups and the venues at which
ID: 3875993 • Letter: C
Question
Consider the following tables describing musical groups and the venues at which they perform: a. Assuming that GID and VID are unique identifiers, what are likely primary keys for the Groups and Venues tables? b. What is the primary key for the Performances table? c. What are foreign keys necessary for this set of tables in order to ensure that only registered penguins can be regions of the Antartica and penguins can only reside in registered regions of the Antartic? d. Can you add a tuple (103, Brass Kings, Classical, 195.00) to the Groups table? Why or why not? e. Can you add the tuple (2, 106) to Performances table? Why or why not? f. Can you remove the tuple (4, Town Arena. 400) from the Venues table? Why or why not?Explanation / Answer
Hi
Answers:
a)
GID, VID are unique identifier so we can be make this column as Primary key because primary key is uniquely identifies each record in a database table. It should be not null. So GID is primary key for Groups table and VID is primary key for Venues table.
b) We know that A table can have only one primary key, which may consist of single or multiple fields.
so in Performances table there is no single column have uniquely identify, in this table we can combine two columns GID and VID get uniquely record each row. so the VALUE of the primary key for Performances table is made up of TWO COLUMNS (GID + VID).
c) In child table have forging key of both parent tables so we can registered region table Primary key in relation child table. If you can provide me tables schemas of this relation i will give id names.
d) We can not add a tuple (103, Brass King, Classical, 195.0) in Groups table because GID is primary key. Primary key can not be dubplicate. 103 is already exists in table.
when we add this tuple in table getting error
Error Code: 1062. Duplicate entry ‘103’ for key ‘PRIMARY’
e) Yes we can add the tuple (2, 106) to Performances table becuase this this tuple unique record not duplicate. (GID + VID) is primary key for this table.
f) Yes We can remove the tuple (4, Town Arean, 400) from the Venues table because there is no VID-4 existence in Performances table.
For example tuple (2, Music Hall, 300) can not delete because 2 is part of Foreign Key in Performances table.