Lecture 4 SQL Ddl
Lecture 4 SQL Ddl
INTRODUCTION TO SQL
Define terms
Interpret history and role of SQL
Define a database using SQL data
definition language
Write single table queries using SQL
Establish referential integrity using
SQL
Discuss SQL:1999 and SQL:2011
standards
Chapter 6 Copyright © 2016 Pearson Education, Inc. 6-2
SQL OVERVIEW
Catalog
A set of schemas that constitute the description of a database
Schema
The structure that contains descriptions of objects created by a
user (base tables, views, constraints)
Data Definition Language (DDL)
Commands that define a database, including creating, altering,
and dropping tables and establishing constraints
Data Manipulation Language (DML)
Commands that maintain and query a database
Data Control Language (DCL)
Commands that control a database, including administering
privileges and committing data
(Oracle 12c)
Overall table
definitions
Primary keys
can never have
NULL values
Primary key
Default value
Domain constraint
Primary key of
parent table
Referential integrity–constraint
that ensures that foreign key
values of a table must match
primary key values of a related
table in 1:M relationships
Restricting:
Deletes of primary records
Updates of primary records
Inserts of dependent records
Chapter 6 Copyright © 2016 Pearson Education, Inc. 6-21
Figure 6-7 Ensuring data integrity through updates
Relational
integrity is
enforced via
the primary-
key to foreign-
key match
Table Actions: