MySQL - Week 1 Quiz
MySQL - Week 1 Quiz
Probability theory
Matrix algebra
Information theory
Question 2
Candidate key
Unique attribute
Composite attribute
Question 3
Which of the following is true about cardinality constraints on the relationship
between Doctor and Outpatient Location depicted in this ER diagram?
A doctor can work at many outpatient locations, but does not have to work at any.
An outpatient location must have at least 1 doctor working at it, but can have many
doctors working at it.
An outpatient location must have 1 doctor working at it, but can have no more than
1 doctor working at it.
Question 4
Which columns would be necessary for identifying unique doctors in the doctor
table of the database built from the relational schema excerpt above?
State
Unique attributes
Foreign keys
Primary keys
Question 6
Which type of information is most likely to be stored in a relational database as
opposed to another type of database?
Pictures
Tweets
Texts
Metadata (file name, file location, when the file was created, etc.) about
pictures (MINE)
Question 7
What can you infer about the data being collected based on the relational schema
above?
The data collected in OL_ID of the WorksAt table, on its own, is sufficient to
determine at which outpatient location(s) each doctor works
A doctor can only work at one outpatient location, but an outpatient location can
have many doctors working at it
Question 8
Based on the diagram above, which attribute(s) can be used to identify unique
books?
BookName
BookName and EditorID
Question 9
Which of the following statements are true about foreign keys? Check all that
apply. (Note that you will need to select more than one correct response to answer
this question correctly.)
Foreign keys are columns with unique values for every row in the relation/table
they are in
Foreign keys refer to columns with unique values for every row in other
relations/tables (MINE)
Foreign keys always have the same name as at least one primary key in another
table
Question 10
Given the relational schema presented above, how many tables would you need to
use in order to determine the outpatient location(s) a doctor named "Karen Smith"
works at?
3 (MINE)
1
Question 11
Which of the following is true about cardinality constraints on the relationship
between Doctor and Outpatient Location depicted in this ER diagram?
A doctor is required to work at one outpatient location, but can work at no more
than 1 outpatient location.
An outpatient location must have at least 1 doctor working at it, but can have
many doctors working at it. (MINE)
A doctor can work at many outpatient locations, but does not have to work at any.
Each outpatient location must have 1 doctor working at it, but can have no more
than 1 doctor working at it.
Question 12
Which of the following statements are true about the technical terms (as
opposed to the common terms) for the concepts represented by relational
schemas?
The technical term for items in a relational schema that become tables in a real
database is “entities”
The technical term for items in a relational schema that become rows in a real
database is “tuples.” (MINE)
The technical term for items in a relational schema that become columns in a real
database is “fields”
Question 13
Based on the diagram above, which of the following is true?
ShowType and ShowName are needed together to provide a unique identifier for
each show
ShowType and ShowVenue are needed together to provide a unique identifier for
each show
ShowID and ShowVenue are needed together to provide a unique identifier for
each show
Question 14
sku” to connect the transactions table to the skuinfo table, and then “deptID”
to connect the skuinfo table to the deptinfo table (MINE)
“sku” to connect the transactions table to the skuinfo table, and then “deptname”
to connect the skuinfo table to the deptinfo table
“store” to connect the transactions table to the storeinfo table, and then
“deptname” to connect the storeinfo table to the deptinfo table
Question 15
For relational databases to work most efficiently, which of the following
requirements of set theory should be followed? Check all that apply. (Note that
you will need to select more than one correct response to answer this question
correctly.)
Single tables should represent the smallest logical parts of a data set (MINE)
——————————————————————————————————
Before you download the written exercises, please read this very important note
about direction of arrows in Relational Schema.
The arrow goes from the table that has a foreign key to the table where the key
comes from (so the arrow points to the primary key).
Try to design a database so that each table has a unified theme with a unique
identifier on each row that is consistent with that theme.
Whenever you have a 1cMany relationship, the relation mapped from the entity on
the Many side of the relationship should get a foreign key that corresponds to the
primary key of the relation on the 1 side of the relationship. This is because you
would have to have duplicate values of the unique identifier of the entity on the 1
side in the table that represents the entity on the Many side.
An example is the description of the database in Question 5 of the relational
Schema exercise said:
"Investment companies can manage multiple mutual funds. Investco Scout will not
keep track of investment companies that do not manage any mutual funds. A
mutual fund is managed by one investment company."
Thus, there is a 1cMany relationship between investment companies (1) and mutual
funds (many), and there should be a foreign key in the mutual funds table that
points to the primary key in the investment company table.
Whenever you have a 1c1 relationship, by the way, it doesn't matter which table has
the primary vs. foreign key. Whenever you have a Many:Many relationship, on the
other hand, recall that you will need a separate linking table that will have two
foreign keys corresponding to the primary keys of the tables that represent the
entities in the Many:Many relationship.