SlideShare a Scribd company logo
1 of 45
CHAPTER 6:
INTRODUCTION TO SQL
Copyright ยฉ 2014 Pearson Education, Inc.
1
Essentials of Database Management
Jeffrey A. Hoffer, Heikki Topi, V. Ramesh
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
OBJECTIVES
๏ƒ’ 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:2008
standards
2
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
SQL OVERVIEW
๏ƒ’ Structured Query Language
๏ƒ’ The standard for relational database
management systems (RDBMS)
๏ƒ’ RDBMS: A database management system
that manages data as a collection of tables in
which all relationships are represented by
common values in related tables
3
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
HISTORY OF SQL
๏ƒ’ 1970โ€“E. F. Codd develops relational database concept
๏ƒ’ 1974-1979โ€“System R with Sequel (later SQL) created at
IBM Research Lab
๏ƒ’ 1979โ€“Oracle markets first relational DB with SQL
๏ƒ’ 1981 โ€“ SQL/DS first available RDBMS system on
DOS/VSE
๏ƒ’ Others followed: INGRES (1981), IDM (1982), DG/SGL
(1984), Sybase (1986)
๏ƒ’ 1986โ€“ANSI SQL standard released
๏ƒ’ 1989, 1992, 1999, 2003, 2006, 2008โ€“Major ANSI
standard updates
๏ƒ’ Currentโ€“SQL is supported by most major database
vendors
4
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
PURPOSE OF SQL STANDARD
๏ƒ’ Specify syntax/semantics for data definition
and manipulation
๏ƒ’ Define data structures and basic operations
๏ƒ’ Enable portability of database definition and
application modules
๏ƒ’ Specify minimal (level 1) and complete (level
2) standards
๏ƒ’ Allow for later growth/enhancement to
standard (referential integrity, transaction
management, user-defined functions,
extended join operations, national character
sets)
5
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
BENEFITS OF A STANDARDIZED
RELATIONAL LANGUAGE
๏ƒ’ Reduced training costs
๏ƒ’ Productivity
๏ƒ’ Application portability
๏ƒ’ Application longevity
๏ƒ’ Reduced dependence on a single
vendor
๏ƒ’ Cross-system communication
6
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
SQL ENVIRONMENT
๏ƒ’ 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
7
8
Figure 6-1
A simplified schematic of a typical SQL environment, as
described by the SQL: 2008 standard
8
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
SQL DATA TYPES
9
10
Figure 6-4
DDL, DML, DCL, and the database development process
10
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
SQL DATABASE DEFINITION
๏ƒ’ Data Definition Language (DDL)
๏ƒ’ Major CREATE statements:
๏ƒ‰ CREATE SCHEMAโ€“defines a portion of the
database owned by a particular user
๏ƒ‰ CREATE TABLEโ€“defines a new table and its
columns
๏ƒ‰ CREATE VIEWโ€“defines a logical table from one
or more tables or views
๏ƒ’ Other CREATE statements: CHARACTER
SET, COLLATION, TRANSLATION, ASSERTION,
DOMAIN
11
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
STEPS IN TABLE CREATION
12
1. Identify data types for attributes
2. Identify columns that can and cannot be null
3. Identify columns that must be unique (candidate
keys)
4. Identify primary keyโ€“foreign key mates
5. Determine default values
6. Identify constraints on columns (domain
specifications)
7. Create the table and associated indexes
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
13
Figure 6-5 General syntax for CREATE TABLE
statement used in data definition language
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
THE FOLLOWING SLIDES CREATE TABLES
FOR THIS ENTERPRISE DATA MODEL
14
(from Chapter 1, Figure 1-3)
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
15
Figure 6-6 SQL database definition commands for Pine Valley Furniture
Company (Oracle 11g)
Overall table
definitions
16
Defining attributes and their data types
16
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
17
Non-nullable specification
Identifying primary key
Primary keys
can never have
NULL values
17
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
18
Non-nullable specifications
Primary key
Some primary keys are compositeโ€“
composed of multiple attributes
18
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
19
Default value
Domain constraint
Controlling the values in attributes
19
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
20
Primary key of
parent table
Identifying foreign keys and establishing relationships
Foreign key of dependent table
20
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
DATA INTEGRITY CONTROLS
๏ƒ’ 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
21
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
CHANGING TABLES
๏ƒ’ ALTER TABLE statement allows you to
change column specifications:
๏ƒ’ Table Actions:
๏ƒ’ Example (adding a new column with a default value):
22
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
REMOVING TABLES
๏ƒ’DROP TABLE statement allows you
to remove tables from your schema:
๏ƒ‰DROP TABLE CUSTOMER_T
23
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
INSERT STATEMENT
๏ƒ’ Adds one or more rows to a table
๏ƒ’ Inserting into a table
๏ƒ’ Inserting a record that has some null attributes
requires identifying the fields that actually get data
๏ƒ’ Inserting from another table
24
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
CREATING TABLES WITH IDENTITY COLUMNS
25
Inserting into a table does not require explicit customer ID entry or
field list
INSERT INTO CUSTOMER_T VALUES ( โ€˜Contemporary Casualsโ€™,
โ€˜1355 S. Himes Blvd.โ€™, โ€˜Gainesvilleโ€™, โ€˜FLโ€™, 32601);
Introduced with SQL:2008
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
DELETE STATEMENT
๏ƒ’ Removes rows from a table
๏ƒ’ Delete certain rows
๏ƒ‰DELETE FROM CUSTOMER_T WHERE
CUSTOMERSTATE = โ€˜HIโ€™;
๏ƒ’ Delete all rows
๏ƒ‰DELETE FROM CUSTOMER_T;
26
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
UPDATE STATEMENT
๏ƒ’ Modifies data in existing rows
27
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
SCHEMA DEFINITION
๏ƒ’ Control processing/storage efficiency:
๏ƒ‰ Choice of indexes
๏ƒ‰ File organizations for base tables
๏ƒ‰ File organizations for indexes
๏ƒ‰ Data clustering
๏ƒ‰ Statistics maintenance
๏ƒ’ Creating indexes
๏ƒ‰ Speed up random/sequential access to base table data
๏ƒ‰ Example
๏ƒ CREATE INDEX NAME_IDX ON
CUSTOMER_T(CUSTOMERNAME)
๏ƒ This makes an index for the CUSTOMERNAME field of the
CUSTOMER_T table
28
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
SELECT STATEMENT
๏ƒ’ Used for queries on single or multiple tables
๏ƒ’ Clauses of the SELECT statement:
๏ƒ‰ SELECT
๏ƒ List the columns (and expressions) to be returned from the query
๏ƒ‰ FROM
๏ƒ Indicate the table(s) or view(s) from which data will be obtained
๏ƒ‰ WHERE
๏ƒ Indicate the conditions under which a row will be included in the
result
๏ƒ‰ GROUP BY
๏ƒ Indicate categorization of results
๏ƒ‰ HAVING
๏ƒ Indicate the conditions under which a category (group) will be
included
๏ƒ‰ ORDER BY
๏ƒ Sorts the result according to specified criteria 29
30
Figure 6-9
SQL statement
processing
order (based
on van der
Lans, 2006
p.100)
30
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
SELECT EXAMPLE
๏ƒ’ Find products with standard price less than
$275
31
Table 6-3: Comparison Operators in SQL
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
SELECT EXAMPLE USING ALIAS
๏ƒ’ Alias is an alternative column or table
name
๏ƒ’ Here, CUST is a table alias and Name is a
column alias
32
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
SELECT EXAMPLE USING A FUNCTION
๏ƒ’ Using the COUNT aggregate function to find
totals
SELECT COUNT(*) FROM ORDERLINE_T
WHERE ORDERID = 1004;
Note: with aggregate functions you canโ€™t have
single-valued columns included in the SELECT
clause, unless they are included in the GROUP
BY clause.
33
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
SELECT EXAMPLEโ€“BOOLEAN OPERATORS
๏ƒ’ AND, OR, and NOT Operators for customizing
conditions in WHERE clause
34
Note: the LIKE operator allows you to compare strings using
wildcards. For example, the % wildcard in โ€˜%Deskโ€™ indicates
that all strings that have any number of characters preceding
the word โ€œDeskโ€ will be allowed.
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
35
Figure 6-7 Boolean query A without use of parentheses
By default,
processing order
of Boolean
operators is
NOT, then AND,
then OR
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
SELECT EXAMPLEโ€“BOOLEAN OPERATORS
๏ƒ’ With parenthesesโ€ฆthese override the normal
precedence of Boolean operators
36
With parentheses, you can override normal precedence rules.
In this case parentheses make the OR take place before the
AND.
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
37
Figure 6-8 Boolean query B with use of parentheses
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
SORTING RESULTS WITH ORDER BY CLAUSE
๏ƒ’ Sort the results first by STATE, and within a
state by the CUSTOMER NAME
38
Note: the IN operator in this example allows you to include rows
whose CustomerState value is either FL, TX, CA, or HI. It is
more efficient than separate OR conditions.
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
CATEGORIZING RESULTS USING GROUP
BY CLAUSE
๏ƒ’ For use with aggregate functions
๏ƒ‰ Scalar aggregate: single value returned from SQL query
with aggregate function
๏ƒ‰ Vector aggregate: multiple values returned from SQL query
with aggregate function (via GROUP BY)
You can use single-value fields with aggregate
functions if they are included in the GROUP BY
clause. 39
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
QUALIFYING RESULTS BY CATEGORIES
USING THE HAVING CLAUSE
๏ƒ’ For use with GROUP BY
Like a WHERE clause, but it operates on
groups (categories), not on individual rows.
Here, only those groups with total numbers
greater than 1 will be included in final result.
40
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
USING AND DEFINING VIEWS
๏ƒ’ Views provide users controlled access to tables
๏ƒ’ Base Tableโ€“table containing the raw data
๏ƒ’ Virtual Tableโ€“constructed automatically as needed;
not maintained as real data
๏ƒ’ Dynamic View
๏ƒ‰ A โ€œvirtual tableโ€ created dynamically upon request by a user
๏ƒ‰ No data actually stored; instead data from base table made
available to user
๏ƒ‰ Based on SQL SELECT statement on base tables or other views
๏ƒ‰ Contents materialized as a result of a query
41
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
SAMPLE CREATE VIEW
42
Query: What are the data elements necessary
to create an invoice for a customer?
Save this query as a view named Invoice_V.
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
ADVANTAGES OF VIEWS
๏ƒ’ Simplify query commands
๏ƒ’ Assist with data security (but don't rely on
views for security, there are more
important security measures)
๏ƒ’ Enhance programming productivity
๏ƒ’ Contain most current base table data
๏ƒ’ Use little storage space
๏ƒ’ Provide customized view for user
๏ƒ’ Establish physical data independence
43
Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
DISADVANTAGES OF VIEWS
๏ƒ’ Use processing time each time view
is referenced
๏ƒ’ May or may not be directly
updateable
44
45
All rights reserved. No part of this publication may be reproduced, stored in a
retrieval system, or transmitted, in any form or by any means, electronic,
mechanical, photocopying, recording, or otherwise, without the prior written
permission of the publisher. Printed in the United States of America.
Copyright ยฉ 2014 Pearson Education, Inc.

More Related Content

Similar to SQLB1.ppt

Chapter 7 relation database language
Chapter 7 relation database languageChapter 7 relation database language
Chapter 7 relation database languageJafar Nesargi
ย 
Chapter 7 relation database language
Chapter 7 relation database languageChapter 7 relation database language
Chapter 7 relation database languageJafar Nesargi
ย 
SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredDanish Mehraj
ย 
Fg d
Fg dFg d
Fg dTaha Khan
ย 
chapter9-SQL.pptx
chapter9-SQL.pptxchapter9-SQL.pptx
chapter9-SQL.pptxYaser52
ย 
Eo gaddis java_chapter_16_5e
Eo gaddis java_chapter_16_5eEo gaddis java_chapter_16_5e
Eo gaddis java_chapter_16_5eGina Bullock
ย 
chap 7.ppt(sql).ppt
chap 7.ppt(sql).pptchap 7.ppt(sql).ppt
chap 7.ppt(sql).pptarjun431527
ย 
Ch 9 S Q L
Ch 9  S Q LCh 9  S Q L
Ch 9 S Q Lguest8fdbdd
ย 
lab14444444444444444444444444444444444444444
lab14444444444444444444444444444444444444444lab14444444444444444444444444444444444444444
lab14444444444444444444444444444444444444444227567
ย 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorialRumman Ansari
ย 
MS SQL - Database Programming Concepts by RSolutions
MS SQL - Database Programming Concepts by RSolutionsMS SQL - Database Programming Concepts by RSolutions
MS SQL - Database Programming Concepts by RSolutionsRSolutions
ย 
Oracle SQL Part1
Oracle SQL Part1Oracle SQL Part1
Oracle SQL Part1Gurpreet singh
ย 
Sql basics
Sql  basicsSql  basics
Sql basicsGenesis Omo
ย 
lovely
lovelylovely
lovelylove0323
ย 
Intro to SQL for Beginners
Intro to SQL for BeginnersIntro to SQL for Beginners
Intro to SQL for BeginnersProduct School
ย 
Oracle Training Tutorial for Beginners
Oracle Training Tutorial for BeginnersOracle Training Tutorial for Beginners
Oracle Training Tutorial for Beginnersrajkamaltibacademy
ย 
SQL Commands
SQL Commands SQL Commands
SQL Commands Divyank Jindal
ย 

Similar to SQLB1.ppt (20)

Chapter 7 relation database language
Chapter 7 relation database languageChapter 7 relation database language
Chapter 7 relation database language
ย 
Chapter 7 relation database language
Chapter 7 relation database languageChapter 7 relation database language
Chapter 7 relation database language
ย 
SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics Covered
ย 
Fg d
Fg dFg d
Fg d
ย 
chapter9-SQL.pptx
chapter9-SQL.pptxchapter9-SQL.pptx
chapter9-SQL.pptx
ย 
7. SQL.pptx
7. SQL.pptx7. SQL.pptx
7. SQL.pptx
ย 
SQL Inteoduction to SQL manipulating of data
SQL Inteoduction to SQL manipulating of data   SQL Inteoduction to SQL manipulating of data
SQL Inteoduction to SQL manipulating of data
ย 
Chap 7
Chap 7Chap 7
Chap 7
ย 
Eo gaddis java_chapter_16_5e
Eo gaddis java_chapter_16_5eEo gaddis java_chapter_16_5e
Eo gaddis java_chapter_16_5e
ย 
chap 7.ppt(sql).ppt
chap 7.ppt(sql).pptchap 7.ppt(sql).ppt
chap 7.ppt(sql).ppt
ย 
Ch 9 S Q L
Ch 9  S Q LCh 9  S Q L
Ch 9 S Q L
ย 
lab14444444444444444444444444444444444444444
lab14444444444444444444444444444444444444444lab14444444444444444444444444444444444444444
lab14444444444444444444444444444444444444444
ย 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
ย 
MS SQL - Database Programming Concepts by RSolutions
MS SQL - Database Programming Concepts by RSolutionsMS SQL - Database Programming Concepts by RSolutions
MS SQL - Database Programming Concepts by RSolutions
ย 
Oracle SQL Part1
Oracle SQL Part1Oracle SQL Part1
Oracle SQL Part1
ย 
Sql basics
Sql  basicsSql  basics
Sql basics
ย 
lovely
lovelylovely
lovely
ย 
Intro to SQL for Beginners
Intro to SQL for BeginnersIntro to SQL for Beginners
Intro to SQL for Beginners
ย 
Oracle Training Tutorial for Beginners
Oracle Training Tutorial for BeginnersOracle Training Tutorial for Beginners
Oracle Training Tutorial for Beginners
ย 
SQL Commands
SQL Commands SQL Commands
SQL Commands
ย 

Recently uploaded

Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
ย 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
ย 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
ย 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
ย 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
ย 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
ย 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
ย 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...tanu pandey
ย 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
ย 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
ย 
Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar โ‰ผ๐Ÿ” Delhi door step de...
Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar  โ‰ผ๐Ÿ” Delhi door step de...Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar  โ‰ผ๐Ÿ” Delhi door step de...
Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar โ‰ผ๐Ÿ” Delhi door step de...9953056974 Low Rate Call Girls In Saket, Delhi NCR
ย 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
ย 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7Call Girls in Nagpur High Profile Call Girls
ย 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLManishPatel169454
ย 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
ย 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
ย 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
ย 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
ย 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .DerechoLaboralIndivi
ย 

Recently uploaded (20)

Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
ย 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
ย 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
ย 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
ย 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
ย 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
ย 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
ย 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
ย 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
ย 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
ย 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
ย 
Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar โ‰ผ๐Ÿ” Delhi door step de...
Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar  โ‰ผ๐Ÿ” Delhi door step de...Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar  โ‰ผ๐Ÿ” Delhi door step de...
Call Now โ‰ฝ 9953056974 โ‰ผ๐Ÿ” Call Girls In New Ashok Nagar โ‰ผ๐Ÿ” Delhi door step de...
ย 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ย 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
ย 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
ย 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
ย 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
ย 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ย 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
ย 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
ย 

SQLB1.ppt

  • 1. CHAPTER 6: INTRODUCTION TO SQL Copyright ยฉ 2014 Pearson Education, Inc. 1 Essentials of Database Management Jeffrey A. Hoffer, Heikki Topi, V. Ramesh
  • 2. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. OBJECTIVES ๏ƒ’ 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:2008 standards 2
  • 3. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. SQL OVERVIEW ๏ƒ’ Structured Query Language ๏ƒ’ The standard for relational database management systems (RDBMS) ๏ƒ’ RDBMS: A database management system that manages data as a collection of tables in which all relationships are represented by common values in related tables 3
  • 4. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. HISTORY OF SQL ๏ƒ’ 1970โ€“E. F. Codd develops relational database concept ๏ƒ’ 1974-1979โ€“System R with Sequel (later SQL) created at IBM Research Lab ๏ƒ’ 1979โ€“Oracle markets first relational DB with SQL ๏ƒ’ 1981 โ€“ SQL/DS first available RDBMS system on DOS/VSE ๏ƒ’ Others followed: INGRES (1981), IDM (1982), DG/SGL (1984), Sybase (1986) ๏ƒ’ 1986โ€“ANSI SQL standard released ๏ƒ’ 1989, 1992, 1999, 2003, 2006, 2008โ€“Major ANSI standard updates ๏ƒ’ Currentโ€“SQL is supported by most major database vendors 4
  • 5. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. PURPOSE OF SQL STANDARD ๏ƒ’ Specify syntax/semantics for data definition and manipulation ๏ƒ’ Define data structures and basic operations ๏ƒ’ Enable portability of database definition and application modules ๏ƒ’ Specify minimal (level 1) and complete (level 2) standards ๏ƒ’ Allow for later growth/enhancement to standard (referential integrity, transaction management, user-defined functions, extended join operations, national character sets) 5
  • 6. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. BENEFITS OF A STANDARDIZED RELATIONAL LANGUAGE ๏ƒ’ Reduced training costs ๏ƒ’ Productivity ๏ƒ’ Application portability ๏ƒ’ Application longevity ๏ƒ’ Reduced dependence on a single vendor ๏ƒ’ Cross-system communication 6
  • 7. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. SQL ENVIRONMENT ๏ƒ’ 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 7
  • 8. 8 Figure 6-1 A simplified schematic of a typical SQL environment, as described by the SQL: 2008 standard 8 Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
  • 9. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. SQL DATA TYPES 9
  • 10. 10 Figure 6-4 DDL, DML, DCL, and the database development process 10 Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
  • 11. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. SQL DATABASE DEFINITION ๏ƒ’ Data Definition Language (DDL) ๏ƒ’ Major CREATE statements: ๏ƒ‰ CREATE SCHEMAโ€“defines a portion of the database owned by a particular user ๏ƒ‰ CREATE TABLEโ€“defines a new table and its columns ๏ƒ‰ CREATE VIEWโ€“defines a logical table from one or more tables or views ๏ƒ’ Other CREATE statements: CHARACTER SET, COLLATION, TRANSLATION, ASSERTION, DOMAIN 11
  • 12. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. STEPS IN TABLE CREATION 12 1. Identify data types for attributes 2. Identify columns that can and cannot be null 3. Identify columns that must be unique (candidate keys) 4. Identify primary keyโ€“foreign key mates 5. Determine default values 6. Identify constraints on columns (domain specifications) 7. Create the table and associated indexes
  • 13. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. 13 Figure 6-5 General syntax for CREATE TABLE statement used in data definition language
  • 14. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. THE FOLLOWING SLIDES CREATE TABLES FOR THIS ENTERPRISE DATA MODEL 14 (from Chapter 1, Figure 1-3)
  • 15. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. 15 Figure 6-6 SQL database definition commands for Pine Valley Furniture Company (Oracle 11g) Overall table definitions
  • 16. 16 Defining attributes and their data types 16 Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
  • 17. 17 Non-nullable specification Identifying primary key Primary keys can never have NULL values 17 Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
  • 18. 18 Non-nullable specifications Primary key Some primary keys are compositeโ€“ composed of multiple attributes 18 Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
  • 19. 19 Default value Domain constraint Controlling the values in attributes 19 Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
  • 20. 20 Primary key of parent table Identifying foreign keys and establishing relationships Foreign key of dependent table 20 Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
  • 21. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. DATA INTEGRITY CONTROLS ๏ƒ’ 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 21
  • 22. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. CHANGING TABLES ๏ƒ’ ALTER TABLE statement allows you to change column specifications: ๏ƒ’ Table Actions: ๏ƒ’ Example (adding a new column with a default value): 22
  • 23. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. REMOVING TABLES ๏ƒ’DROP TABLE statement allows you to remove tables from your schema: ๏ƒ‰DROP TABLE CUSTOMER_T 23
  • 24. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. INSERT STATEMENT ๏ƒ’ Adds one or more rows to a table ๏ƒ’ Inserting into a table ๏ƒ’ Inserting a record that has some null attributes requires identifying the fields that actually get data ๏ƒ’ Inserting from another table 24
  • 25. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. CREATING TABLES WITH IDENTITY COLUMNS 25 Inserting into a table does not require explicit customer ID entry or field list INSERT INTO CUSTOMER_T VALUES ( โ€˜Contemporary Casualsโ€™, โ€˜1355 S. Himes Blvd.โ€™, โ€˜Gainesvilleโ€™, โ€˜FLโ€™, 32601); Introduced with SQL:2008
  • 26. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. DELETE STATEMENT ๏ƒ’ Removes rows from a table ๏ƒ’ Delete certain rows ๏ƒ‰DELETE FROM CUSTOMER_T WHERE CUSTOMERSTATE = โ€˜HIโ€™; ๏ƒ’ Delete all rows ๏ƒ‰DELETE FROM CUSTOMER_T; 26
  • 27. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. UPDATE STATEMENT ๏ƒ’ Modifies data in existing rows 27
  • 28. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. SCHEMA DEFINITION ๏ƒ’ Control processing/storage efficiency: ๏ƒ‰ Choice of indexes ๏ƒ‰ File organizations for base tables ๏ƒ‰ File organizations for indexes ๏ƒ‰ Data clustering ๏ƒ‰ Statistics maintenance ๏ƒ’ Creating indexes ๏ƒ‰ Speed up random/sequential access to base table data ๏ƒ‰ Example ๏ƒ CREATE INDEX NAME_IDX ON CUSTOMER_T(CUSTOMERNAME) ๏ƒ This makes an index for the CUSTOMERNAME field of the CUSTOMER_T table 28
  • 29. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. SELECT STATEMENT ๏ƒ’ Used for queries on single or multiple tables ๏ƒ’ Clauses of the SELECT statement: ๏ƒ‰ SELECT ๏ƒ List the columns (and expressions) to be returned from the query ๏ƒ‰ FROM ๏ƒ Indicate the table(s) or view(s) from which data will be obtained ๏ƒ‰ WHERE ๏ƒ Indicate the conditions under which a row will be included in the result ๏ƒ‰ GROUP BY ๏ƒ Indicate categorization of results ๏ƒ‰ HAVING ๏ƒ Indicate the conditions under which a category (group) will be included ๏ƒ‰ ORDER BY ๏ƒ Sorts the result according to specified criteria 29
  • 30. 30 Figure 6-9 SQL statement processing order (based on van der Lans, 2006 p.100) 30 Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc.
  • 31. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. SELECT EXAMPLE ๏ƒ’ Find products with standard price less than $275 31 Table 6-3: Comparison Operators in SQL
  • 32. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. SELECT EXAMPLE USING ALIAS ๏ƒ’ Alias is an alternative column or table name ๏ƒ’ Here, CUST is a table alias and Name is a column alias 32
  • 33. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. SELECT EXAMPLE USING A FUNCTION ๏ƒ’ Using the COUNT aggregate function to find totals SELECT COUNT(*) FROM ORDERLINE_T WHERE ORDERID = 1004; Note: with aggregate functions you canโ€™t have single-valued columns included in the SELECT clause, unless they are included in the GROUP BY clause. 33
  • 34. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. SELECT EXAMPLEโ€“BOOLEAN OPERATORS ๏ƒ’ AND, OR, and NOT Operators for customizing conditions in WHERE clause 34 Note: the LIKE operator allows you to compare strings using wildcards. For example, the % wildcard in โ€˜%Deskโ€™ indicates that all strings that have any number of characters preceding the word โ€œDeskโ€ will be allowed.
  • 35. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. 35 Figure 6-7 Boolean query A without use of parentheses By default, processing order of Boolean operators is NOT, then AND, then OR
  • 36. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. SELECT EXAMPLEโ€“BOOLEAN OPERATORS ๏ƒ’ With parenthesesโ€ฆthese override the normal precedence of Boolean operators 36 With parentheses, you can override normal precedence rules. In this case parentheses make the OR take place before the AND.
  • 37. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. 37 Figure 6-8 Boolean query B with use of parentheses
  • 38. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. SORTING RESULTS WITH ORDER BY CLAUSE ๏ƒ’ Sort the results first by STATE, and within a state by the CUSTOMER NAME 38 Note: the IN operator in this example allows you to include rows whose CustomerState value is either FL, TX, CA, or HI. It is more efficient than separate OR conditions.
  • 39. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. CATEGORIZING RESULTS USING GROUP BY CLAUSE ๏ƒ’ For use with aggregate functions ๏ƒ‰ Scalar aggregate: single value returned from SQL query with aggregate function ๏ƒ‰ Vector aggregate: multiple values returned from SQL query with aggregate function (via GROUP BY) You can use single-value fields with aggregate functions if they are included in the GROUP BY clause. 39
  • 40. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. QUALIFYING RESULTS BY CATEGORIES USING THE HAVING CLAUSE ๏ƒ’ For use with GROUP BY Like a WHERE clause, but it operates on groups (categories), not on individual rows. Here, only those groups with total numbers greater than 1 will be included in final result. 40
  • 41. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. USING AND DEFINING VIEWS ๏ƒ’ Views provide users controlled access to tables ๏ƒ’ Base Tableโ€“table containing the raw data ๏ƒ’ Virtual Tableโ€“constructed automatically as needed; not maintained as real data ๏ƒ’ Dynamic View ๏ƒ‰ A โ€œvirtual tableโ€ created dynamically upon request by a user ๏ƒ‰ No data actually stored; instead data from base table made available to user ๏ƒ‰ Based on SQL SELECT statement on base tables or other views ๏ƒ‰ Contents materialized as a result of a query 41
  • 42. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. SAMPLE CREATE VIEW 42 Query: What are the data elements necessary to create an invoice for a customer? Save this query as a view named Invoice_V.
  • 43. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. ADVANTAGES OF VIEWS ๏ƒ’ Simplify query commands ๏ƒ’ Assist with data security (but don't rely on views for security, there are more important security measures) ๏ƒ’ Enhance programming productivity ๏ƒ’ Contain most current base table data ๏ƒ’ Use little storage space ๏ƒ’ Provide customized view for user ๏ƒ’ Establish physical data independence 43
  • 44. Chapter 6 Copyright ยฉ 2014 Pearson Education, Inc. DISADVANTAGES OF VIEWS ๏ƒ’ Use processing time each time view is referenced ๏ƒ’ May or may not be directly updateable 44
  • 45. 45 All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher. Printed in the United States of America. Copyright ยฉ 2014 Pearson Education, Inc.