Lab 3 _ ERD to Relational Model
Write SQL queries to create tables with keys and relations corresponding to each of the
following question. Note that you should submit [Link] for Question 1, [Link] for Question
2,…
To submit, select all your .sql file and compress into a .zip file named
YourRollNumber_YourName.zip
NOTICE that when creating the SQL commands as request, you MUST keep the name
of tables, relationships, attributes and data type of attributes as SAME as given in the
given ERD.
Attributes have written with underline are Primary Key of each entity.
Attributes which reference to the primary key of another table must have the same
name as the attributes in the primary key of the referencing table.
When submitting the responses for this question, submit only SQL statements for
creating tables with corresponding keys and foreign keys. No SQL statement specifying
the database name like create database, alter database or use database_name is
accepted.
Question 1 ([Link]):
Gender: bit
ActivityID: Name: Name:
nvarchar(30) MemberID: nvarchar(30)
int
int
Date:
Date Activities Participates Members
Description: BirthDate:
nvarchar(100) Date
Organizes
Join
Manage
ToDate:
Date
Clubs FromDate:
Date
ClubID: int Name:
nvarchar(100)
Question 2 ([Link]):
NbOfHours:
int
ExNumber: Description: Name:
int ntext nvarchar(90)
SectionNo:
int
Exercises Has Sections
Mark: float
BelongTo
Courses
Credits:
CourseID: int Name: int
nvarchar(100)
Question 3 ([Link]): Note that when an entity has a role named “RName” in a relationship,
please use RName_PName for the name of attributes referencing to the primary key of this
entity; where RName is the name of the role and PName is the name of attribute in the
primary key of the entity.
DepartureTime:
Flight#: AirportCode: AirportName:
Time
varchar(10) varchar(10) nvarchar(50)
Flights From Airports
Go City:
nvarchar(20)
Duration: int
To
Date: Date
Company:
AirPlane#: Airplanes varchar(20)
varchar(10)
SeatNumbers:
int
Question 4 ([Link]): Please transform the subclasses into tables by using entity relationship
conversion.
Spetialty: BirthDate: Date
PersonID
nvarchar(50)
varchar(11)
Teachers IsA Persons
Name:
nvarchar(50)
Belong
IsA
Class#:
Departments Students varchar(10)
Belong
DeptID: Name:
varchar(10) nvarchar(50)