Experiment #1: DDL Statements (Create Tables)
Experiment #1: DDL Statements (Create Tables)
Experiment #1:
DDL Statements (Create Tables)
Student’s Name:
Semester: Date:
Assessment:
Discussion of results
Participation
Comments:
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.
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
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.