Chapter Chapter 66 Introduction to SQLIntroduction to SQL

Chapter 6

Introduction to SQL

1

Objectives

?

?

?

?

?

Define terms

Define a database using SQL data definition

language

Write single table queries using SQL

Establish referential integrity using SQL

Discuss SQL:1999

Q

and SQL:200n

Q

standards

2

Figure 6-1

A simplified schematic of a typical SQL environment, as

d

described

ib d b

by th

the SQL

SQL: 200

200n standard

t d d

3

SQL Overview

?

Structured Query Language

?

The standard for relational database management

systems

t

(RDBMS)

?

RDBMS: A database management system that

manages data as a collection of tables in which all

relationships

p are represented

p

by

y common values in

related tables

4

SQL

Q Environment

?

Data Definition Language (DDL)

?

?

Data Manipulation Language (DML)

?

?

Commands that define a database, including creating, altering,

and dropping tables and establishing constraints

Commands that maintain and query a database

Data Control Language (DCL)

?

Commands that control a database, including administering

privileges and committing data

5

SQL Data Types

6

DDL: Table Creation

Figure 6-5

Fi

6 5 General

G

l syntax ffor CREATE

TABLE statement used in data

definition language

g g

Steps in table creation:

1 Identify data types for

1.

attributes

2. Identify columns that can

and

d cannott b

be nullll

3. Identify columns that

must be unique

(candidate keys)

4. Identify primary key¨C

foreign key mates

5. Determine default values

6. Identifyy constraints on

columns (domain

specifications)

7 Create the table and

7.

associated indexes

7

The following slides create tables for

thi enterprise

this

t

i data

d t model

d l

((from Chapter

p

1,, Figure

g

1-3))

8

Figure 6-6 SQL database definition commands for Pine Valley Furniture

Company (Oracle 11g)

Overall table

definitions

9

1. Defining attributes and their data types

10

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download