SlideShare uma empresa Scribd logo
1 de 68
David M. Kroenke and David J. Auer
Database Processing:
Fundamentals, Design, and Implementation
Chapter Two:
Introduction to
Structured Query
Language
2-1KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Chapter Objectives
• To understand the use of extracted data sets in business
intelligence (BI) systems
• To understand the use of ad-hoc queries in business
intelligence (BI) systems
• To understand the history and significance of Structured
Query Language (SQL)
• To understand the SQL SELECT/FROM/WHERE
framework as the basis for database queries
• To create SQL queries to retrieve data from a single
table
2-2KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Chapter Objectives
• To create SQL queries that use the SQL SELECT,
FROM, WHERE, ORDER BY, GROUP BY, and HAVING
clauses
• To create SQL queries that use the SQL DISTINCT,
AND, OR, NOT, BETWEEN, LIKE, and IN keywords
• To create SQL queries that use the SQL built-in functions
of SUM, COUNT, MIN, MAX, and AVG with and without
the use of a GROUP BY clause
2-3KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Chapter Objectives
• To create SQL queries that retrieve data from a single
table but restrict the data based upon data in another
table (subquery)
• To create SQL queries that retrieve data from multiple
tables using an SQL join operation
2-4KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Business Intelligence (BI) Systems
• Business intelligence (BI) systems are
information systems that assist managers
and other professionals:
– Assessment
– Analysis
– Planning
– Control
2-5KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Ad-Hoc Queries
• Ad-hoc queries:
– Questions that can be answered using
database data
– Example: “How many customers in Portland,
Oregon, bought our green baseball cap?”
– Created by the user as needed, instead of
programmed into an application
– Common in business
2-6KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Components of a Data Warehouse
2-7KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Structured Query Language
• Structured Query Language (SQL) was
developed by the IBM Corporation in the late
1970’s.
• SQL was endorsed as a U.S. national standard
by the American National Standards Institute
(ANSI) in 1992 [SQL-92].
• Newer versions exist, and they incorporate XML
and some object-oriented concepts.
2-8KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
SQL As a Data Sublanguage
• SQL is not a full featured programming
language.
– C, C#, Java
• SQL is a data sublanguage for creating
and processing database data and
metadata.
• SQL is ubiquitous in enterprise-class
DBMS products.
• SQL programming is a critical skill.
2-9KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
SQL DDL, DML, and SQL/PSM
• SQL statements can be divided into three
categories:
– Data definition language (DDL) statements
• Used for creating tables, relationships, and other
structures
• Covered in Chapter 7
– Data manipulation language (DML)
statements
• Used for queries and data modification
• Covered in this chapter (Chapter 2)
2-10KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
SQL DDL, DML, and SQL/PSM
– SQL/Persistent Stored Modules (SQL/PSM)
statements
• Add procedural programming capabilities
– Variables
– Control-of-flow statements
• Covered in Chapters:
– 7 (general introduction)
– 10 (SQL Server 2008 R2)
– 10A (Oralce Database 11g)
– 10B (MySQL 5.5)
2-11KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Cape Codd Outdoor Sports
• Cape Codd Outdoor Sports is a fictitious
company based on an actual outdoor retail
equipment vendor.
• Cape Codd Outdoor Sports:
– Has 15 retail stores in the United States and
Canada.
– Has an online Internet store.
– Has a (postal) mail order department.
• All retail sales are recorded in an Oracle
database.
2-12KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Cape Codd Retail Sales Structure
2-13KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Cape Codd Retail Sales Data
Extraction
• The Cape Codd marketing department needs an
analysis of in-store sales.
• The entire database is not needed for this, only an
extraction of retail sales data.
• The data is extracted by the IS department from the
operational database into a separate, off-line
database for use by the marketing department.
• Three tables are used: RETAIL_ORDER,
ORDER_ITEM, and SKU_DATA (SKU = Stock Keeping
Unit).
• The extracted data is converted as necessary:
– Into a different DBMS—Microsoft SQL Server
– Into different columns—OrderDate becomes OrderMonth and
OrderYear.
2-14KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Extracted
Retail
Sales Data
Format
2-15KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Retail Sales Extract Tables
[in Microsoft Access 2010]
2-16KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
The SQL SELECT Statement
• The fundamental framework for an SQL
query is the SQL SELECT statement.
– SELECT {ColumnName(s)}
– FROM {TableName(s)}
– WHERE {Condition(s)}
• All SQL statements end with a semi-colon
(;).
2-17KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Specific Columns on One Table
SELECT Department, Buyer
FROM SKU_DATA;
2-18KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Specifying Column Order
SELECT Buyer, Department
FROM SKU_DATA;
2-19KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
The DISTINCT Keyword
SELECT DISTINCT Buyer, Department
FROM SKU_DATA;
2-20KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Selecting All Columns:
The Asterisk (*) Wildcard Character
SELECT *
FROM SKU_DATA;
2-21KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Specific Rows from One Table
SELECT *
FROM SKU_DATA
WHERE Department = 'Water Sports';
NOTE: SQL wants a plain ASCII single quote: ' NOT ‘ !
2-22KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Specific Columns and Rows from
One Table
SELECT SKU_Description, Buyer
FROM SKU_DATA
WHERE Department = 'Climbing';
2-23KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Using Microsoft Access I
2-24KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Using Microsoft Access II
2-25KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Using Microsoft Access III
2-26KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Using Microsoft Access IV
2-27KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Using Microsoft Access V
2-28KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Using Microsoft Access—Results
2-29KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Using Microsoft Access
Saving the Query
2-30KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Using Microsoft Access
The Named and Saved Query
2-31KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Using Microsoft SQL Server 2008 R2
The Microsoft SQL Server Management Studio I
2-32KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Using Microsoft SQL Server 2008 R2
The Microsoft SQL Server Management Studio II
2-33KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Using Oracle Database 11g
SQL Developer I
2-34KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Using Oracle Database 11g
SQL Developer II
2-35KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Using MySQL 5.5
MySQL Workbench I
2-36KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Using MySQL 5.5
MySQL Workbench II
2-37KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Sorting the Results—ORDER BY
SELECT *
FROM ORDER_ITEM
ORDER BY OrderNumber, Price;
2-38KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Sort Order:
Ascending and Descending
SELECT *
FROM ORDER_ITEM
ORDER BY Price DESC, OrderNumber ASC;
NOTE: The default sort order is ASC—does not have to be specified.
2-39KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
WHERE Clause Options—AND
SELECT *
FROM SKU_DATA
WHERE Department = 'Water Sports'
AND Buyer = 'Nancy Meyers';
2-40KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
WHERE Clause Options—OR
SELECT *
FROM SKU_DATA
WHERE Department = 'Camping'
OR Department = 'Climbing';
2-41KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
WHERE Clause Options—IN
SELECT *
FROM SKU_DATA
WHERE Buyer IN ('Nancy Meyers',
'Cindy Lo', 'Jerry Martin');
2-42KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
WHERE Clause Options—NOT IN
SELECT *
FROM SKU_DATA
WHERE Buyer NOT IN ('Nancy Meyers',
'Cindy Lo', 'Jerry Martin');
2-43KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
WHERE Clause Options—
Ranges with BETWEEN
SELECT *
FROM ORDER_ITEM
WHERE ExtendedPrice
BETWEEN 100 AND 200;
2-44KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
WHERE Clause Options—
Ranges with Math Symbols
SELECT *
FROM ORDER_ITEM
WHERE ExtendedPrice >= 100
AND ExtendedPrice <= 200;
2-45KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
WHERE Clause Options—
LIKE and Wildcards I
• The SQL keyword LIKE can be combined
with wildcard symbols:
– SQL 92 Standard (SQL Server, MySQL, etc.):
• _ = exactly one character
• % = any set of one or more characters
– Microsoft Access (based on MS DOS)
• ? = exactly one character
• * = any set of one or more characters
2-46KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
WHERE Clause Options—
LIKE and Wildcards II
SELECT *
FROM SKU_DATA
WHERE Buyer LIKE 'Pete%';
2-47KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
WHERE Clause Options—
LIKE and Wildcards III
SELECT *
FROM SKU_DATA
WHERE Buyer LIKE '%Tent%';
2-48KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
WHERE Clause Options—
LIKE and Wildcards IV
SELECT *
FROM SKU_DATA
WHERE SKU LIKE '%2__';
2-49KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
SQL Built-In Functions I
• There are five SQL built-in functions:
– COUNT
– SUM
– AVG
– MIN
– MAX
2-50KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
SQL Built-In Functions II
SELECT SUM(ExtendedPrice)
AS Order3000Sum
FROM ORDER_ITEM
WHERE OrderNumber = 3000;
2-51KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
SQL Built-In Functions III
SELECT SUM(ExtendedPrice) AS OrderItemSum,
AVG(ExtendedPrice) AS OrderItemAvg,
MIN(ExtendedPrice) AS OrderItemMin,
MAX(ExtendedPrice) AS OrderItemMax
FROM ORDER_ITEM;
2-52KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
SQL Built-In Functions IV
SELECT COUNT(*) AS NumberOfRows
FROM ORDER_ITEM;
2-53KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
SQL Built-In Functions V
SELECT COUNT
(DISTINCT Department)
AS DeptCount
FROM SKU_DATA;
2-54KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Arithmetic in SELECT Statements
SELECT Quantity * Price AS EP,
ExtendedPrice
FROM ORDER_ITEM;
2-55KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
String Functions in SELECT
Statements
SELECT DISTINCT RTRIM (Buyer)
+ ' in ' + RTRIM (Department)
AS Sponsor
FROM SKU_DATA;
2-56KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
NOTE: This SQL statement uses SQL Server 2008 R2 syntax—other DBMS
products use different concatenation and character string operators.
The SQL Keyword GROUP BY I
SELECT Department, Buyer,
COUNT(*) AS
Dept_Buyer_SKU_Count
FROM SKU_DATA
GROUP BY Department, Buyer;
2-57KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
The SQL Keyword GROUP BY II
• In general, place WHERE before GROUP BY.
Some DBMS products do not require that
placement; but to be safe, always put WHERE
before GROUP BY.
• The HAVING operator restricts the groups that
are presented in the result.
• There is an ambiguity in statements that include
both WHERE and HAVING clauses. The results
can vary, so to eliminate this ambiguity SQL
always applies WHERE before HAVING.
2-58KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
The SQL Keyword GROUP BY III
SELECT Department, COUNT(*) AS
Dept_SKU_Count
FROM SKU_DATA
WHERE SKU <> 302000
GROUP BY Department
ORDER BY Dept_SKU_Count;
2-59KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
The SQL Keyword GROUP BY IV
SELECT Department, COUNT(*) AS
Dept_SKU_Count
FROM SKU_DATA
WHERE SKU <> 302000
GROUP BY Department
HAVING COUNT (*) > 1
ORDER BY Dept_SKU_Count;
2-60KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Querying Multiple Tables:
Subqueries I
SELECT SUM (ExtendedPrice) AS Revenue
FROM ORDER_ITEM
WHERE SKU IN
(SELECT SKU
FROM SKU_DATA
WHERE Department = 'Water Sports');
Note: The second SELECT statement is a subquery.
2-61KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Querying Multiple Tables:
Subqueries II
SELECT Buyer
FROM SKU_DATA
WHERE SKU IN
(SELECT SKU
FROM ORDER_ITEM
WHERE OrderNumber IN
(SELECT OrderNumber
FROM RETAIL_ORDER
WHERE OrderMonth = 'January'
AND OrderYear = 2011));
2-62KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Querying Multiple Tables:
Joins I
SELECT Buyer, ExtendedPrice
FROM SKU_DATA, ORDER_ITEM
WHERE SKU_DATA.SKU =
ORDER_ITEM.SKU;
2-63KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Querying Multiple Tables:
Joins II
SELECT Buyer, SUM(ExtendedPrice)
AS BuyerRevenue
FROM SKU_DATA, ORDER_ITEM
WHERE SKU_DATA.SKU = ORDER_ITEM.SKU
GROUP BY Buyer
ORDER BY BuyerRevenue DESC;
2-64KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Querying Multiple Tables:
Joins III
SELECT Buyer, ExtendedPrice, OrderMonth
FROM SKU_DATA, ORDER_ITEM, RETAIL_ORDER
WHERE SKU_DATA.SKU = ORDER_ITEM.SKU
AND ORDER_ITEM.OrderNumber =
RETAIL_ORDER.OrderNumber;
2-65KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
Subqueries versus Joins
• Subqueries and joins both process multiple
tables.
• A subquery can only be used to retrieve data
from the top table.
• A join can be used to obtain data from any
number of tables, including the “top table” of the
subquery.
• In Chapter 7, we will study the correlated
subquery. That kind of subquery can do work
that is not possible with joins.
2-66KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
David Kroenke and David Auer
Database Processing
Fundamentals, Design, and Implementation
(11th
Edition)
End of Presentation:
Chapter Two
2-67KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall
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 © 2012 Pearson Education, Inc.  Copyright © 2012 Pearson Education, Inc.  
Publishing as Prentice HallPublishing as Prentice Hall
2-68KROENKE AND AUER - DATABASE PROCESSING, 12th Edition
© 2012 Pearson Prentice Hall

Mais conteúdo relacionado

Mais procurados

Thejokumar_Oracle_DBA_resume
Thejokumar_Oracle_DBA_resumeThejokumar_Oracle_DBA_resume
Thejokumar_Oracle_DBA_resumeThejokumar M.
 
Introduction to oracle database (basic concepts)
Introduction to oracle database (basic concepts)Introduction to oracle database (basic concepts)
Introduction to oracle database (basic concepts)Bilal Arshad
 
DEE 431 Introduction to Mysql Slide 3
DEE 431 Introduction to Mysql Slide 3DEE 431 Introduction to Mysql Slide 3
DEE 431 Introduction to Mysql Slide 3YOGESH SINGH
 
SamBarrie_Primaryvzt
SamBarrie_PrimaryvztSamBarrie_Primaryvzt
SamBarrie_PrimaryvztSam Barrie
 
Basic oracle-database-administration
Basic oracle-database-administrationBasic oracle-database-administration
Basic oracle-database-administrationsreehari orienit
 
FileTable and Semantic Search in SQL Server 2012
FileTable and Semantic Search in SQL Server 2012FileTable and Semantic Search in SQL Server 2012
FileTable and Semantic Search in SQL Server 2012Michael Rys
 
Avanthi Guduru ( Oracle DBA) Resume
Avanthi Guduru ( Oracle DBA) ResumeAvanthi Guduru ( Oracle DBA) Resume
Avanthi Guduru ( Oracle DBA) ResumeAvanthi Guduru
 
Narendra_Oracle DBA_4.1 years of expriances_Bangalore
Narendra_Oracle DBA_4.1 years of expriances_BangaloreNarendra_Oracle DBA_4.1 years of expriances_Bangalore
Narendra_Oracle DBA_4.1 years of expriances_BangaloreNaremdra L
 
The oracle database architecture
The oracle database architectureThe oracle database architecture
The oracle database architectureAkash Pramanik
 
Intro to Database Design
Intro to Database DesignIntro to Database Design
Intro to Database DesignSondra Willhite
 
Himanshu_Oracle_DBA_Resume
Himanshu_Oracle_DBA_ResumeHimanshu_Oracle_DBA_Resume
Himanshu_Oracle_DBA_ResumeHimanshu Jain
 
Oracle dba training
Oracle  dba    training Oracle  dba    training
Oracle dba training P S Rani
 

Mais procurados (20)

ORACLE DBA RESUME
ORACLE DBA RESUMEORACLE DBA RESUME
ORACLE DBA RESUME
 
Thejokumar_Oracle_DBA_resume
Thejokumar_Oracle_DBA_resumeThejokumar_Oracle_DBA_resume
Thejokumar_Oracle_DBA_resume
 
Oracle archi ppt
Oracle archi pptOracle archi ppt
Oracle archi ppt
 
Introduction to oracle database (basic concepts)
Introduction to oracle database (basic concepts)Introduction to oracle database (basic concepts)
Introduction to oracle database (basic concepts)
 
DEE 431 Introduction to Mysql Slide 3
DEE 431 Introduction to Mysql Slide 3DEE 431 Introduction to Mysql Slide 3
DEE 431 Introduction to Mysql Slide 3
 
SamBarrie_Primaryvzt
SamBarrie_PrimaryvztSamBarrie_Primaryvzt
SamBarrie_Primaryvzt
 
Basic oracle-database-administration
Basic oracle-database-administrationBasic oracle-database-administration
Basic oracle-database-administration
 
Siva-Resume
Siva-ResumeSiva-Resume
Siva-Resume
 
FileTable and Semantic Search in SQL Server 2012
FileTable and Semantic Search in SQL Server 2012FileTable and Semantic Search in SQL Server 2012
FileTable and Semantic Search in SQL Server 2012
 
SubbaReddy dba Resume
SubbaReddy dba ResumeSubbaReddy dba Resume
SubbaReddy dba Resume
 
Subhani_OrDBA5+
Subhani_OrDBA5+Subhani_OrDBA5+
Subhani_OrDBA5+
 
Avanthi Guduru ( Oracle DBA) Resume
Avanthi Guduru ( Oracle DBA) ResumeAvanthi Guduru ( Oracle DBA) Resume
Avanthi Guduru ( Oracle DBA) Resume
 
Narendra_Oracle DBA_4.1 years of expriances_Bangalore
Narendra_Oracle DBA_4.1 years of expriances_BangaloreNarendra_Oracle DBA_4.1 years of expriances_Bangalore
Narendra_Oracle DBA_4.1 years of expriances_Bangalore
 
The oracle database architecture
The oracle database architectureThe oracle database architecture
The oracle database architecture
 
CV_avneet
CV_avneetCV_avneet
CV_avneet
 
Oracle Tablespace - Basic
Oracle Tablespace - BasicOracle Tablespace - Basic
Oracle Tablespace - Basic
 
Intro to Database Design
Intro to Database DesignIntro to Database Design
Intro to Database Design
 
Himanshu_Oracle_DBA_Resume
Himanshu_Oracle_DBA_ResumeHimanshu_Oracle_DBA_Resume
Himanshu_Oracle_DBA_Resume
 
shailendra dba resume
shailendra dba resumeshailendra dba resume
shailendra dba resume
 
Oracle dba training
Oracle  dba    training Oracle  dba    training
Oracle dba training
 

Destaque

2 entity relationship_model
2 entity relationship_model2 entity relationship_model
2 entity relationship_modelUtkarsh De
 
[Www.pkbulk.blogspot.com]dbms02
[Www.pkbulk.blogspot.com]dbms02[Www.pkbulk.blogspot.com]dbms02
[Www.pkbulk.blogspot.com]dbms02AnusAhmad
 
Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)Vidyasagar Mundroy
 
introduction to database
 introduction to database introduction to database
introduction to databaseAkif shexi
 
Fundamentals of Database system
Fundamentals of Database systemFundamentals of Database system
Fundamentals of Database systemphilipsinter
 
Chapter 1 Fundamentals of Database Management System
Chapter 1 Fundamentals of Database Management SystemChapter 1 Fundamentals of Database Management System
Chapter 1 Fundamentals of Database Management SystemEddyzulham Mahluzydde
 
Data base management system
Data base management systemData base management system
Data base management systemNavneet Jingar
 
Modern database management jeffrey a. hoffer, mary b. prescott,
Modern database management   jeffrey a. hoffer, mary b. prescott,  Modern database management   jeffrey a. hoffer, mary b. prescott,
Modern database management jeffrey a. hoffer, mary b. prescott, BlackIce86
 
Database Management Systems (DBMS)
Database Management Systems (DBMS)Database Management Systems (DBMS)
Database Management Systems (DBMS)Dimara Hakim
 
Database management system
Database management systemDatabase management system
Database management systemRizwanHafeez
 
Types of databases
Types of databasesTypes of databases
Types of databasesPAQUIAAIZEL
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMSkoolkampus
 
Database management system presentation
Database management system presentationDatabase management system presentation
Database management system presentationsameerraaj
 

Destaque (20)

ER MODEL
ER MODELER MODEL
ER MODEL
 
2 entity relationship_model
2 entity relationship_model2 entity relationship_model
2 entity relationship_model
 
[Www.pkbulk.blogspot.com]dbms02
[Www.pkbulk.blogspot.com]dbms02[Www.pkbulk.blogspot.com]dbms02
[Www.pkbulk.blogspot.com]dbms02
 
Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)
 
Modul basis data
Modul basis dataModul basis data
Modul basis data
 
Solution2(database)
Solution2(database)Solution2(database)
Solution2(database)
 
introduction to database
 introduction to database introduction to database
introduction to database
 
Fundamentals of Database system
Fundamentals of Database systemFundamentals of Database system
Fundamentals of Database system
 
Chapter 1 Fundamentals of Database Management System
Chapter 1 Fundamentals of Database Management SystemChapter 1 Fundamentals of Database Management System
Chapter 1 Fundamentals of Database Management System
 
Types dbms
Types dbmsTypes dbms
Types dbms
 
Data base management system
Data base management systemData base management system
Data base management system
 
Modern database management jeffrey a. hoffer, mary b. prescott,
Modern database management   jeffrey a. hoffer, mary b. prescott,  Modern database management   jeffrey a. hoffer, mary b. prescott,
Modern database management jeffrey a. hoffer, mary b. prescott,
 
Database Management Systems (DBMS)
Database Management Systems (DBMS)Database Management Systems (DBMS)
Database Management Systems (DBMS)
 
Database management system
Database management systemDatabase management system
Database management system
 
Types of databases
Types of databasesTypes of databases
Types of databases
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
 
Basic DBMS ppt
Basic DBMS pptBasic DBMS ppt
Basic DBMS ppt
 
Dbms slides
Dbms slidesDbms slides
Dbms slides
 
Database management system presentation
Database management system presentationDatabase management system presentation
Database management system presentation
 

Semelhante a Database management chapter 2 power point

Things learned from OpenWorld 2013
Things learned from OpenWorld 2013Things learned from OpenWorld 2013
Things learned from OpenWorld 2013Connor McDonald
 
YASEEN EDA VALAPPIL
YASEEN EDA VALAPPILYASEEN EDA VALAPPIL
YASEEN EDA VALAPPILYASEEN EV
 
Using your DB2 SQL Skills with Hadoop and Spark
Using your DB2 SQL Skills with Hadoop and SparkUsing your DB2 SQL Skills with Hadoop and Spark
Using your DB2 SQL Skills with Hadoop and SparkCynthia Saracco
 
MongoDB for Oracle Experts - OUGF Harmony 2014
MongoDB for Oracle Experts - OUGF Harmony 2014 MongoDB for Oracle Experts - OUGF Harmony 2014
MongoDB for Oracle Experts - OUGF Harmony 2014 Henrik Ingo
 
MOUG17 Keynote: Oracle OpenWorld Major Announcements
MOUG17 Keynote: Oracle OpenWorld Major AnnouncementsMOUG17 Keynote: Oracle OpenWorld Major Announcements
MOUG17 Keynote: Oracle OpenWorld Major AnnouncementsMonica Li
 
EXACC Presentat CHEUG 2019 (9).pptx
EXACC Presentat CHEUG 2019 (9).pptxEXACC Presentat CHEUG 2019 (9).pptx
EXACC Presentat CHEUG 2019 (9).pptxabdulhafeezkalsekar1
 
SURENDRA KUMAR_MADDI_Latest_Resume
SURENDRA KUMAR_MADDI_Latest_ResumeSURENDRA KUMAR_MADDI_Latest_Resume
SURENDRA KUMAR_MADDI_Latest_ResumeSurendra Maddi
 
App301 Implement a Data Access Layer with Ent Lib
App301 Implement a Data Access Layer with Ent LibApp301 Implement a Data Access Layer with Ent Lib
App301 Implement a Data Access Layer with Ent Libmcgurk
 
War of the Indices- SQL Server and Oracle
War of the Indices-  SQL Server and OracleWar of the Indices-  SQL Server and Oracle
War of the Indices- SQL Server and OracleKellyn Pot'Vin-Gorman
 
Resume_HasnathFathema_AppsDBA_PSG
Resume_HasnathFathema_AppsDBA_PSGResume_HasnathFathema_AppsDBA_PSG
Resume_HasnathFathema_AppsDBA_PSGHasnath Fathema
 
Oracle Application Express 20.2 New Features
Oracle Application Express 20.2 New FeaturesOracle Application Express 20.2 New Features
Oracle Application Express 20.2 New Featuresmsewtz
 
Oracle BPM workflow and Open-XDX web services (Part 2)
Oracle BPM workflow and Open-XDX web services (Part 2)Oracle BPM workflow and Open-XDX web services (Part 2)
Oracle BPM workflow and Open-XDX web services (Part 2)Bizagi Inc
 
COUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_FeaturesCOUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_FeaturesAlfredo Abate
 
Guob consolidation implementation11gr2
Guob consolidation implementation11gr2Guob consolidation implementation11gr2
Guob consolidation implementation11gr2Rodrigo Almeida
 
EDB NoSQL German Webinar 2015
EDB NoSQL German Webinar 2015EDB NoSQL German Webinar 2015
EDB NoSQL German Webinar 2015EDB
 
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...NomanKhalid56
 
Munir_Database_Developer
Munir_Database_DeveloperMunir_Database_Developer
Munir_Database_DeveloperMunir Muhammad
 
Novinky ve světě Oracle DB a koncept konvergované databáze
Novinky ve světě Oracle DB a koncept konvergované databázeNovinky ve světě Oracle DB a koncept konvergované databáze
Novinky ve světě Oracle DB a koncept konvergované databázeMarketingArrowECS_CZ
 

Semelhante a Database management chapter 2 power point (20)

Things learned from OpenWorld 2013
Things learned from OpenWorld 2013Things learned from OpenWorld 2013
Things learned from OpenWorld 2013
 
YASEEN EDA VALAPPIL
YASEEN EDA VALAPPILYASEEN EDA VALAPPIL
YASEEN EDA VALAPPIL
 
Using your DB2 SQL Skills with Hadoop and Spark
Using your DB2 SQL Skills with Hadoop and SparkUsing your DB2 SQL Skills with Hadoop and Spark
Using your DB2 SQL Skills with Hadoop and Spark
 
MongoDB for Oracle Experts - OUGF Harmony 2014
MongoDB for Oracle Experts - OUGF Harmony 2014 MongoDB for Oracle Experts - OUGF Harmony 2014
MongoDB for Oracle Experts - OUGF Harmony 2014
 
MOUG17 Keynote: Oracle OpenWorld Major Announcements
MOUG17 Keynote: Oracle OpenWorld Major AnnouncementsMOUG17 Keynote: Oracle OpenWorld Major Announcements
MOUG17 Keynote: Oracle OpenWorld Major Announcements
 
EXACC Presentat CHEUG 2019 (9).pptx
EXACC Presentat CHEUG 2019 (9).pptxEXACC Presentat CHEUG 2019 (9).pptx
EXACC Presentat CHEUG 2019 (9).pptx
 
SURENDRA KUMAR_MADDI_Latest_Resume
SURENDRA KUMAR_MADDI_Latest_ResumeSURENDRA KUMAR_MADDI_Latest_Resume
SURENDRA KUMAR_MADDI_Latest_Resume
 
App301 Implement a Data Access Layer with Ent Lib
App301 Implement a Data Access Layer with Ent LibApp301 Implement a Data Access Layer with Ent Lib
App301 Implement a Data Access Layer with Ent Lib
 
War of the Indices- SQL Server and Oracle
War of the Indices-  SQL Server and OracleWar of the Indices-  SQL Server and Oracle
War of the Indices- SQL Server and Oracle
 
Resume_HasnathFathema_AppsDBA_PSG
Resume_HasnathFathema_AppsDBA_PSGResume_HasnathFathema_AppsDBA_PSG
Resume_HasnathFathema_AppsDBA_PSG
 
Oracle Application Express 20.2 New Features
Oracle Application Express 20.2 New FeaturesOracle Application Express 20.2 New Features
Oracle Application Express 20.2 New Features
 
Oracle BPM workflow and Open-XDX web services (Part 2)
Oracle BPM workflow and Open-XDX web services (Part 2)Oracle BPM workflow and Open-XDX web services (Part 2)
Oracle BPM workflow and Open-XDX web services (Part 2)
 
COUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_FeaturesCOUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_Features
 
Tah 03302015 withendclient
Tah 03302015 withendclientTah 03302015 withendclient
Tah 03302015 withendclient
 
Guob consolidation implementation11gr2
Guob consolidation implementation11gr2Guob consolidation implementation11gr2
Guob consolidation implementation11gr2
 
EDB NoSQL German Webinar 2015
EDB NoSQL German Webinar 2015EDB NoSQL German Webinar 2015
EDB NoSQL German Webinar 2015
 
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...
5675212318661411677_TRN4034_How_to_Migrate_to_Oracle_Autonomous_Database_Clou...
 
Mohammed Gulam
Mohammed GulamMohammed Gulam
Mohammed Gulam
 
Munir_Database_Developer
Munir_Database_DeveloperMunir_Database_Developer
Munir_Database_Developer
 
Novinky ve světě Oracle DB a koncept konvergované databáze
Novinky ve světě Oracle DB a koncept konvergované databázeNovinky ve světě Oracle DB a koncept konvergované databáze
Novinky ve světě Oracle DB a koncept konvergované databáze
 

Último

A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 

Último (20)

A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 

Database management chapter 2 power point

  • 1. David M. Kroenke and David J. Auer Database Processing: Fundamentals, Design, and Implementation Chapter Two: Introduction to Structured Query Language 2-1KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 2. Chapter Objectives • To understand the use of extracted data sets in business intelligence (BI) systems • To understand the use of ad-hoc queries in business intelligence (BI) systems • To understand the history and significance of Structured Query Language (SQL) • To understand the SQL SELECT/FROM/WHERE framework as the basis for database queries • To create SQL queries to retrieve data from a single table 2-2KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 3. Chapter Objectives • To create SQL queries that use the SQL SELECT, FROM, WHERE, ORDER BY, GROUP BY, and HAVING clauses • To create SQL queries that use the SQL DISTINCT, AND, OR, NOT, BETWEEN, LIKE, and IN keywords • To create SQL queries that use the SQL built-in functions of SUM, COUNT, MIN, MAX, and AVG with and without the use of a GROUP BY clause 2-3KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 4. Chapter Objectives • To create SQL queries that retrieve data from a single table but restrict the data based upon data in another table (subquery) • To create SQL queries that retrieve data from multiple tables using an SQL join operation 2-4KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 5. Business Intelligence (BI) Systems • Business intelligence (BI) systems are information systems that assist managers and other professionals: – Assessment – Analysis – Planning – Control 2-5KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 6. Ad-Hoc Queries • Ad-hoc queries: – Questions that can be answered using database data – Example: “How many customers in Portland, Oregon, bought our green baseball cap?” – Created by the user as needed, instead of programmed into an application – Common in business 2-6KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 7. Components of a Data Warehouse 2-7KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 8. Structured Query Language • Structured Query Language (SQL) was developed by the IBM Corporation in the late 1970’s. • SQL was endorsed as a U.S. national standard by the American National Standards Institute (ANSI) in 1992 [SQL-92]. • Newer versions exist, and they incorporate XML and some object-oriented concepts. 2-8KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 9. SQL As a Data Sublanguage • SQL is not a full featured programming language. – C, C#, Java • SQL is a data sublanguage for creating and processing database data and metadata. • SQL is ubiquitous in enterprise-class DBMS products. • SQL programming is a critical skill. 2-9KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 10. SQL DDL, DML, and SQL/PSM • SQL statements can be divided into three categories: – Data definition language (DDL) statements • Used for creating tables, relationships, and other structures • Covered in Chapter 7 – Data manipulation language (DML) statements • Used for queries and data modification • Covered in this chapter (Chapter 2) 2-10KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 11. SQL DDL, DML, and SQL/PSM – SQL/Persistent Stored Modules (SQL/PSM) statements • Add procedural programming capabilities – Variables – Control-of-flow statements • Covered in Chapters: – 7 (general introduction) – 10 (SQL Server 2008 R2) – 10A (Oralce Database 11g) – 10B (MySQL 5.5) 2-11KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 12. Cape Codd Outdoor Sports • Cape Codd Outdoor Sports is a fictitious company based on an actual outdoor retail equipment vendor. • Cape Codd Outdoor Sports: – Has 15 retail stores in the United States and Canada. – Has an online Internet store. – Has a (postal) mail order department. • All retail sales are recorded in an Oracle database. 2-12KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 13. Cape Codd Retail Sales Structure 2-13KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 14. Cape Codd Retail Sales Data Extraction • The Cape Codd marketing department needs an analysis of in-store sales. • The entire database is not needed for this, only an extraction of retail sales data. • The data is extracted by the IS department from the operational database into a separate, off-line database for use by the marketing department. • Three tables are used: RETAIL_ORDER, ORDER_ITEM, and SKU_DATA (SKU = Stock Keeping Unit). • The extracted data is converted as necessary: – Into a different DBMS—Microsoft SQL Server – Into different columns—OrderDate becomes OrderMonth and OrderYear. 2-14KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 15. Extracted Retail Sales Data Format 2-15KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 16. Retail Sales Extract Tables [in Microsoft Access 2010] 2-16KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 17. The SQL SELECT Statement • The fundamental framework for an SQL query is the SQL SELECT statement. – SELECT {ColumnName(s)} – FROM {TableName(s)} – WHERE {Condition(s)} • All SQL statements end with a semi-colon (;). 2-17KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 18. Specific Columns on One Table SELECT Department, Buyer FROM SKU_DATA; 2-18KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 19. Specifying Column Order SELECT Buyer, Department FROM SKU_DATA; 2-19KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 20. The DISTINCT Keyword SELECT DISTINCT Buyer, Department FROM SKU_DATA; 2-20KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 21. Selecting All Columns: The Asterisk (*) Wildcard Character SELECT * FROM SKU_DATA; 2-21KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 22. Specific Rows from One Table SELECT * FROM SKU_DATA WHERE Department = 'Water Sports'; NOTE: SQL wants a plain ASCII single quote: ' NOT ‘ ! 2-22KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 23. Specific Columns and Rows from One Table SELECT SKU_Description, Buyer FROM SKU_DATA WHERE Department = 'Climbing'; 2-23KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 24. Using Microsoft Access I 2-24KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 25. Using Microsoft Access II 2-25KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 26. Using Microsoft Access III 2-26KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 27. Using Microsoft Access IV 2-27KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 28. Using Microsoft Access V 2-28KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 29. Using Microsoft Access—Results 2-29KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 30. Using Microsoft Access Saving the Query 2-30KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 31. Using Microsoft Access The Named and Saved Query 2-31KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 32. Using Microsoft SQL Server 2008 R2 The Microsoft SQL Server Management Studio I 2-32KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 33. Using Microsoft SQL Server 2008 R2 The Microsoft SQL Server Management Studio II 2-33KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 34. Using Oracle Database 11g SQL Developer I 2-34KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 35. Using Oracle Database 11g SQL Developer II 2-35KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 36. Using MySQL 5.5 MySQL Workbench I 2-36KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 37. Using MySQL 5.5 MySQL Workbench II 2-37KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 38. Sorting the Results—ORDER BY SELECT * FROM ORDER_ITEM ORDER BY OrderNumber, Price; 2-38KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 39. Sort Order: Ascending and Descending SELECT * FROM ORDER_ITEM ORDER BY Price DESC, OrderNumber ASC; NOTE: The default sort order is ASC—does not have to be specified. 2-39KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 40. WHERE Clause Options—AND SELECT * FROM SKU_DATA WHERE Department = 'Water Sports' AND Buyer = 'Nancy Meyers'; 2-40KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 41. WHERE Clause Options—OR SELECT * FROM SKU_DATA WHERE Department = 'Camping' OR Department = 'Climbing'; 2-41KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 42. WHERE Clause Options—IN SELECT * FROM SKU_DATA WHERE Buyer IN ('Nancy Meyers', 'Cindy Lo', 'Jerry Martin'); 2-42KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 43. WHERE Clause Options—NOT IN SELECT * FROM SKU_DATA WHERE Buyer NOT IN ('Nancy Meyers', 'Cindy Lo', 'Jerry Martin'); 2-43KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 44. WHERE Clause Options— Ranges with BETWEEN SELECT * FROM ORDER_ITEM WHERE ExtendedPrice BETWEEN 100 AND 200; 2-44KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 45. WHERE Clause Options— Ranges with Math Symbols SELECT * FROM ORDER_ITEM WHERE ExtendedPrice >= 100 AND ExtendedPrice <= 200; 2-45KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 46. WHERE Clause Options— LIKE and Wildcards I • The SQL keyword LIKE can be combined with wildcard symbols: – SQL 92 Standard (SQL Server, MySQL, etc.): • _ = exactly one character • % = any set of one or more characters – Microsoft Access (based on MS DOS) • ? = exactly one character • * = any set of one or more characters 2-46KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 47. WHERE Clause Options— LIKE and Wildcards II SELECT * FROM SKU_DATA WHERE Buyer LIKE 'Pete%'; 2-47KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 48. WHERE Clause Options— LIKE and Wildcards III SELECT * FROM SKU_DATA WHERE Buyer LIKE '%Tent%'; 2-48KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 49. WHERE Clause Options— LIKE and Wildcards IV SELECT * FROM SKU_DATA WHERE SKU LIKE '%2__'; 2-49KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 50. SQL Built-In Functions I • There are five SQL built-in functions: – COUNT – SUM – AVG – MIN – MAX 2-50KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 51. SQL Built-In Functions II SELECT SUM(ExtendedPrice) AS Order3000Sum FROM ORDER_ITEM WHERE OrderNumber = 3000; 2-51KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 52. SQL Built-In Functions III SELECT SUM(ExtendedPrice) AS OrderItemSum, AVG(ExtendedPrice) AS OrderItemAvg, MIN(ExtendedPrice) AS OrderItemMin, MAX(ExtendedPrice) AS OrderItemMax FROM ORDER_ITEM; 2-52KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 53. SQL Built-In Functions IV SELECT COUNT(*) AS NumberOfRows FROM ORDER_ITEM; 2-53KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 54. SQL Built-In Functions V SELECT COUNT (DISTINCT Department) AS DeptCount FROM SKU_DATA; 2-54KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 55. Arithmetic in SELECT Statements SELECT Quantity * Price AS EP, ExtendedPrice FROM ORDER_ITEM; 2-55KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 56. String Functions in SELECT Statements SELECT DISTINCT RTRIM (Buyer) + ' in ' + RTRIM (Department) AS Sponsor FROM SKU_DATA; 2-56KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall NOTE: This SQL statement uses SQL Server 2008 R2 syntax—other DBMS products use different concatenation and character string operators.
  • 57. The SQL Keyword GROUP BY I SELECT Department, Buyer, COUNT(*) AS Dept_Buyer_SKU_Count FROM SKU_DATA GROUP BY Department, Buyer; 2-57KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 58. The SQL Keyword GROUP BY II • In general, place WHERE before GROUP BY. Some DBMS products do not require that placement; but to be safe, always put WHERE before GROUP BY. • The HAVING operator restricts the groups that are presented in the result. • There is an ambiguity in statements that include both WHERE and HAVING clauses. The results can vary, so to eliminate this ambiguity SQL always applies WHERE before HAVING. 2-58KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 59. The SQL Keyword GROUP BY III SELECT Department, COUNT(*) AS Dept_SKU_Count FROM SKU_DATA WHERE SKU <> 302000 GROUP BY Department ORDER BY Dept_SKU_Count; 2-59KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 60. The SQL Keyword GROUP BY IV SELECT Department, COUNT(*) AS Dept_SKU_Count FROM SKU_DATA WHERE SKU <> 302000 GROUP BY Department HAVING COUNT (*) > 1 ORDER BY Dept_SKU_Count; 2-60KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 61. Querying Multiple Tables: Subqueries I SELECT SUM (ExtendedPrice) AS Revenue FROM ORDER_ITEM WHERE SKU IN (SELECT SKU FROM SKU_DATA WHERE Department = 'Water Sports'); Note: The second SELECT statement is a subquery. 2-61KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 62. Querying Multiple Tables: Subqueries II SELECT Buyer FROM SKU_DATA WHERE SKU IN (SELECT SKU FROM ORDER_ITEM WHERE OrderNumber IN (SELECT OrderNumber FROM RETAIL_ORDER WHERE OrderMonth = 'January' AND OrderYear = 2011)); 2-62KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 63. Querying Multiple Tables: Joins I SELECT Buyer, ExtendedPrice FROM SKU_DATA, ORDER_ITEM WHERE SKU_DATA.SKU = ORDER_ITEM.SKU; 2-63KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 64. Querying Multiple Tables: Joins II SELECT Buyer, SUM(ExtendedPrice) AS BuyerRevenue FROM SKU_DATA, ORDER_ITEM WHERE SKU_DATA.SKU = ORDER_ITEM.SKU GROUP BY Buyer ORDER BY BuyerRevenue DESC; 2-64KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 65. Querying Multiple Tables: Joins III SELECT Buyer, ExtendedPrice, OrderMonth FROM SKU_DATA, ORDER_ITEM, RETAIL_ORDER WHERE SKU_DATA.SKU = ORDER_ITEM.SKU AND ORDER_ITEM.OrderNumber = RETAIL_ORDER.OrderNumber; 2-65KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 66. Subqueries versus Joins • Subqueries and joins both process multiple tables. • A subquery can only be used to retrieve data from the top table. • A join can be used to obtain data from any number of tables, including the “top table” of the subquery. • In Chapter 7, we will study the correlated subquery. That kind of subquery can do work that is not possible with joins. 2-66KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 67. David Kroenke and David Auer Database Processing Fundamentals, Design, and Implementation (11th Edition) End of Presentation: Chapter Two 2-67KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
  • 68. 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 © 2012 Pearson Education, Inc.  Copyright © 2012 Pearson Education, Inc.   Publishing as Prentice HallPublishing as Prentice Hall 2-68KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall