Id (PK) Name Age: SQL Surgery
Id (PK) Name Age: SQL Surgery
b) Display all information pertaining to frogs sorted alphabetically by age in ascending order.
d) Display all information pertaining to frogs who have a name beginning with P.
f)
Display all information pertaining to frogs whose age is 3 or more or who are called Al.
i)
SQL Surgery
Name
Pom
Pi
Al
Ed
Wu
Stu
Age
3
3
2
4
1
3
ID [FK]
1
1
2
3
4
4
5
Operations
Notes
Success
Success
Died
Died
Partial Success
Success
Died
a) Write a MySQL query to show all the operation notes with the name of the corresponding frog
using a Natural Join and a theta equi-join.
b) Stu the Frog has not had an operation. What kind of join would include Stu the Frog as well as
showing all the operation notes of all the other frogs?
c)
Write an SQL query to show the name and operation notes of all the frogs, but also include Stu
and show that he has had no operations
d) Are Frog and Operations are weak or strong entities? Explain why.
3. Consider the following MySQL statements that generate a single table database and populate it
with data.
CREATE TABLE HospitalAppointments(
PatientID Integer, PatientName TEXT, OpticianID Integer, OpticianName
TEXT, Appointment1 DATE, Notes1 TEXT, Appointment2 DATE, Notes2 TEXT,
PRIMARY KEY (PatientID, SurgeonID)
);
This table is not in 3NF. State why, and design code for new MySQL table(s) that are in 3NF.
SQL Surgery