0% found this document useful (0 votes)
206 views

Lab3 ERD2Relational Spring2020 PDF

This document provides instructions for creating SQL queries to build tables from entity relationship diagrams. It includes 4 questions, each with an ERD and instructions to submit the SQL statements to build the tables, keys, and relationships shown in the ERD. The questions involve creating tables for activities and members, exercises and sections, flights and airports, and transforming subclasses into tables for teachers, students, and departments. The SQL is to be submitted in individual files named for each question.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
206 views

Lab3 ERD2Relational Spring2020 PDF

This document provides instructions for creating SQL queries to build tables from entity relationship diagrams. It includes 4 questions, each with an ERD and instructions to submit the SQL statements to build the tables, keys, and relationships shown in the ERD. The questions involve creating tables for activities and members, exercises and sections, flights and airports, and transforming subclasses into tables for teachers, students, and departments. The SQL is to be submitted in individual files named for each question.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

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 Q1.sql for Question 1, Q2.sql 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 (Q1.sql):

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 (Q2.sql):

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 (Q3.sql): 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 (Q4.sql): 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)

You might also like