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

Lab3 ERD2Relational Fa2022

The document provides instructions for creating SQL queries to build tables from entity relationship diagrams. It includes 4 questions, each with an ERD depicting entities, attributes, and relationships. Students are asked to submit .sql files named by question number to build the corresponding tables based on the ERDs, including primary keys, foreign keys, and attributes as specified in the ERDs. No other SQL statements are permitted in the submissions other than those needed to build the tables.
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)
42 views

Lab3 ERD2Relational Fa2022

The document provides instructions for creating SQL queries to build tables from entity relationship diagrams. It includes 4 questions, each with an ERD depicting entities, attributes, and relationships. Students are asked to submit .sql files named by question number to build the corresponding tables based on the ERDs, including primary keys, foreign keys, and attributes as specified in the ERDs. No other SQL statements are permitted in the submissions other than those needed to build the tables.
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
hours: int

JobID: int Title: Name:


nvarchar(100) EmpID: int nvarchar(30)

hourSalary:
money Jobs
has Employees

BirthDate:
Date
BelongsTo
WorkFor

ToDate:
Date

Departments FromDate:
Date

DepartmentID: 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.

Department: Gender:
StaffID
nvarchar(50) char(1)
varchar(11)

Nurses IsA Staffs

Name:
nvarchar(50)
Belong
IsA

specialty:
Rooms Doctors nvarchar(50)

RoomID: int Type:


nvarchar(50)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy