Professional Documents
Culture Documents
BESE-12
LECTURE OUTLINE
DDL-Introduction
Database Objects
Create
Alter
Drop
2
DDL INTRODUCTION
CREATING TABLES AND INCLUDING
CONSTRAINTS
OVERVIEW OF LECTURE
Including Constraints
5
KEYS
6
TYPES OF KEYS
7
CREATING AND MANAGING TABLES
OBJECTIVES
9
DATABASE OBJECTS
Object Description
Table Basic unit of storage; composed of rows
and columns
10
NAMING RULES
11
THE CREATE TABLE STATEMENT
12
REFERENCING ANOTHER USER’S TABLES
13
THE DEFAULT OPTION
DESCRIBE dept
15
TABLES IN THE DATABASE
User Tables:
Are a collection of tables created and maintained by the
user
Contain user information
Data Dictionary:
Is a collection of tables created and maintained by the
Database Server
Contain database information
16
QUERYING THE DATA DICTIONARY
19
CREATING A TABLE BY USING A SUBQUERY
CREATE TABLE dept80
AS
SELECT employee_id, last_name,
salary*12 ANNSAL,
hire_date
FROM employees
WHERE department_id = 80;
Table created.
DESCRIBE dept80
20
THE ALTER TABLE STATEMENT
21
THE ALTER TABLE STATEMENT
22
ADDING A COLUMN
New column
DEPT80
“Add a new
column to
the DEPT80
table.”
DEPT80
23
ADDING A COLUMN
24
MODIFYING A COLUMN
25
DROPPING A COLUMN
26
THE SET UNUSED OPTION
27
DROPPING A TABLE
28
CHANGING THE NAME OF AN OBJECT
29
TRUNCATING A TABLE
30
ADDING COMMENTS TO A TABLE