0% found this document useful (0 votes)
219 views5 pages

Experiment #1: DDL Statements (Create Tables)

This document is a lab manual for a Database Systems course. It provides instructions and objectives for Experiment 1, which involves creating database tables using Data Definition Language (DDL) statements. The experiment maps an example company data model to relational tables. Students are asked to create an EMP table and DEPT table based on the given attributes and constraints. The document discusses mapping entity-relationship models to relational schemas and provides the table structures to implement for the example company database.

Uploaded by

hala arabiat
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)
219 views5 pages

Experiment #1: DDL Statements (Create Tables)

This document is a lab manual for a Database Systems course. It provides instructions and objectives for Experiment 1, which involves creating database tables using Data Definition Language (DDL) statements. The experiment maps an example company data model to relational tables. Students are asked to create an EMP table and DEPT table based on the given attributes and constraints. The document discusses mapping entity-relationship models to relational schemas and provides the table structures to implement for the example company database.

Uploaded by

hala arabiat
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/ 5

Al-Balqa Applied University

Faculty of Engineering Technology


Department of Computer Engineering and Networks

Course Name: Database Systems Lab Manual


Course Number: 30102422

Experiment #1:
DDL Statements (Create Tables)

Student’s Name:

Semester: Date:

Assessment:

Assessment Point Weight Grade

Methodology and correctness of results

Discussion of results

Participation

Assessment Points’ Grade:

Comments:

Prepared By: Eng.Randa Al-Dallah@2018-2019


Experiment #1:
DDL Statements (Create tables)

Objectives:
After completing this experiment, you should be able to do the following:
• Working with oracle 10g express environment
• Mapping the ER model to Relational model
• Review the table structure
• List the data types that are available for columns
• Create a simple table
• Explain how constraints are created at the time of table creation

Discussion:
The ER model defines the conceptual view of a database. It works around real-world entities and
the associations among them. At view level, the ER model is considered a good option for designing
databases.
The process of doing database design generally consists of a number of steps which will be carried
out by more than one database user. Usually, the DB Analyst interview the prospective database
users to understand and document their data requirements. The DB Designer use a High-Level
Conceptual Data Model (ERM) to describe the database, then the DB Designer implement the
database by defining the database schema (tables).
In this course a part of company database is used as a sample to test the SQL statements. The
description of the company database is: The system analyst stated the following description of the
“miniworld”—the part of the company to be represented in the database:
1. The company is organized into departments. Each department has a unique name, a
unique number, a location, and a particular employee who manages the department. We
keep track of the start date when that employee began managing the department.
2. We store each employee’s name, number, job, salary, commission, hire date, and birth
date. An employee is worked in one department. We keep track of the direct supervisor
of each employee.

Prepared By: Eng.Randa Al-Dallah 2


The ERM for the company database illustrated in figure 1

Figure 1: Company ERM

Procedure:
Exercises:
a) Map the company ERM to relational model as follows:

Emp Table
Column Name Data type Default value Constraints
Empno Number (4) - Primary Key
Ename Varchar2 (15) - Not Null
Job Varchar2 (15) - -
Hiredate Date Sysdate -
Sal Number (7,2) - Sal >= 500
Comm Number (7,2) - -
SuperEno Number (4) - Foreign Key
Dno Number (2) - Foreign Key + Set Null option

Prepared By: Eng.Randa Al-Dallah 3


Dept Table
Column Name Data type Default value Constraints
Dno Number (2) - Primary Key
Dname Varchar2 (20) - Not Null + Unique
Dlocation Varchar2 (20) - -
MgrEno Number (4) - Foreign Key
StartDate Date - Foreign Key

b) Open the IDE for oracle 10g express environment and create a new user with DBA privilege
then relogin to the IDE using the new user.

c) Implement the company relational model using DDL statements.

Create EMP Table with the appropriate constraints:

Prepared By: Eng.Randa Al-Dallah 4


Create DEPT Table with the appropriate constraints:

Prepared By: Eng.Randa Al-Dallah 5

You might also like