SlideShare ist ein Scribd-Unternehmen logo
1 von 56
SQL200 SQL Programming Based on  SQL Clearly Explained  by Jan Harrington Module  1 – Relational Database Background, Basic Single Table Retrieval Operations Bookstore SQL200  Module 1
Note on SQL200 Slides ,[object Object],[object Object],[object Object],Bookstore2 SQL200  Module 2
Warning! ,[object Object],Bookstore2 SQL200  Module 2 New Name Old Name Orders Order_filled Order_Lines Orderlines
SQL200 Contact Information Bookstore2 SQL200  Module 2 P.O. Box 6142 Laguna Niguel, CA 92607 949-489-1472 http://www.d2associates.com [email_address]   Copyright 2001-2011. All rights reserved.
SQL200 Resources ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Bookstore SQL212  Module 1
SQL Programming ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Bookstore SQL200  Module 1
SQL Programming ,[object Object],[object Object],Bookstore SQL200  Module 1
Relational Database Evolution ,[object Object],[object Object],[object Object],[object Object],Bookstore SQL200  Module 1
Relational Database Basics ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Bookstore SQL200  Module 1
Bookstore SQL200  Module 1 Relational Database Table
Constraints ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Bookstore SQL200  Module 1
Bookstore SQL200  Module 1 Relational Database with constraints
Database Management Systems Bookstore SQL200  Module 1 Positioning Chart VLDB Enterprise Workgroup Single user Spreadsheet # Users Cost
System Architecture Bookstore SQL200  Module 1 Access MDB File Server  Architecture Access
System Architecture Bookstore SQL200  Module 1 Oracle DB Visual Basic App Client/Server  Architecture Access  SQL 
System Architecture Bookstore SQL200  Module 1 Oracle DB Browser Web  Architecture Web Server  SQL 
Approaching SQL ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Bookstore SQL200  Module 1
SQL Standardization ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Bookstore SQL200  Module 1
SQL Conformance ,[object Object],[object Object],[object Object],[object Object],Bookstore SQL200  Module 1
SQL Statements ,[object Object],[object Object],[object Object],[object Object],Bookstore SQL200  Module 1
SQL DDL ,[object Object],[object Object],[object Object],[object Object],Bookstore SQL200  Module 1
SQL DCL ,[object Object],[object Object],[object Object],[object Object],[object Object],Bookstore SQL200  Module 1
SQL DML ,[object Object],[object Object],[object Object],[object Object],[object Object],Bookstore SQL200  Module 1
SQL Statement Processing Bookstore SQL200  Module 1 Parse Validate Optimize Access Plan Execute
Bookstore Sample Database ,[object Object],[object Object],[object Object],[object Object],[object Object],Bookstore SQL200  Module 1
Text Conventions ,[object Object],[object Object],[object Object],[object Object],Bookstore SQL200  Module 1
Date Conventions ,[object Object],[object Object],[object Object],[object Object],Bookstore SQL200  Module 1
SELECT Bookstore SQL200  Module 1 Basic Syntax ( Projection ): Select <column-list> or <*> From <table-list>
SELECT Bookstore SQL200  Module 1 Basic Example ( Projection ): select   customer_last_name,  customer_street from  customers
MS Access SQL Query Bookstore SQL200  Module 1
Bookstore SQL200  Module 1
SQL Server Query Bookstore SQL200  Module 1
SELECT with Where Clause Bookstore SQL200  Module 1 Example ( Restriction  plus   Projection ): Select <column-list> From <table-list> Where <selection-criteria>;
Comparison Operators ,[object Object],[object Object],[object Object],[object Object],[object Object],Bookstore SQL200  Module 1
SELECT with Where Bookstore SQL200  Module 1 Basic Example ( Restriction plus Projection ): select   customer_last_name,  customer_street from  customers where  customer_last_name = ‘Jones’
Select with Where Bookstore SQL200  Module 1
On Your Own ,[object Object],[object Object],Bookstore SQL200  Module 1
Complex Predicates Bookstore SQL200  Module 1 Follow normal boolean logic Select   customer_last_name,  customer_street From  customers Where  (customer_last_name = ‘Jones’ or customer_last_name = ‘Smith’)and customer_state=‘NY’
Select with Complex Where Bookstore SQL200  Module 1
Complex Where Result Bookstore SQL200  Module 1
Special Operators ,[object Object],[object Object],[object Object],[object Object],[object Object],Bookstore SQL200  Module 1
Like (“Wild Card Matches”) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Bookstore SQL200  Module 1
IN Bookstore SQL200  Module 1 Select  * From  customers Where  customer_last_name in (‘Rizzo’, ‘Jones’, ‘Garcia’) The list in parentheses can be replaced by a subquery. We will study this later.
SQL Where Clause with IN Bookstore SQL200  Module 1
IS NULL Bookstore SQL200  Module 1 Select  * From  customers Where  customer_street IS NULL  SQL uses three valued logic. Must use IS NULL to test for unknowns. A null is NOT the same as blank or empty.
On Your Own ,[object Object],[object Object],[object Object],Bookstore SQL200  Module 1
BETWEEN Bookstore SQL200  Module 1 Select * From orders Where order_date BETWEEN ‘1-Jan-99’ and ’31-Dec-99’ Note: date formats vary from product to product.
Where with Between Bookstore SQL200  Module 1
Removing Duplicates Bookstore SQL200  Module 1 Select DISTINCT  customer_city From  customers List once each city in which there are customers Removes duplicate rows from result set
Removing Duplicates Bookstore SQL200  Module 1
Sorting – ORDER BY Bookstore SQL200  Module 1 DESC will sort in descending order Basic syntax : Select <column list> From <table list> Where <selection criteria> Order by <column list> [DESC]
Sorting – ORDER BY Bookstore SQL200  Module 1 Select  * From  customers Order by  customer_state, customer_city Example: List all records sorted by state, city
Sorting Results with Order By Bookstore SQL200  Module 1
Selecting Top Records Bookstore SQL200  Module 1 Select Top 5 (or top 25 percent)  Customer_last_name  , contact_zip From  customers Order by customer_zip  desc ; List largest 5 zips or top 25 % of them…
SQL Exercises ,[object Object],[object Object],[object Object],[object Object],Bookstore SQL200  Module 1 [end module]
Notes Bookstore SQL200  Module 1

Weitere ähnliche Inhalte

Was ist angesagt?

Sql Pass Through
Sql Pass ThroughSql Pass Through
Sql Pass Through
jrhampt
 

Was ist angesagt? (19)

Sql for biggner
Sql for biggnerSql for biggner
Sql for biggner
 
Sql Pass Through
Sql Pass ThroughSql Pass Through
Sql Pass Through
 
SQL Pass Through and the ODBC Interface
SQL Pass Through and the ODBC InterfaceSQL Pass Through and the ODBC Interface
SQL Pass Through and the ODBC Interface
 
Oracle SQL Basics
Oracle SQL BasicsOracle SQL Basics
Oracle SQL Basics
 
Structured Query Language (SQL)
Structured Query Language (SQL)Structured Query Language (SQL)
Structured Query Language (SQL)
 
New T-SQL Features in SQL Server 2012
New T-SQL Features in SQL Server 2012 New T-SQL Features in SQL Server 2012
New T-SQL Features in SQL Server 2012
 
SQL Overview
SQL OverviewSQL Overview
SQL Overview
 
Introduction to the Structured Query Language SQL
Introduction to the Structured Query Language SQLIntroduction to the Structured Query Language SQL
Introduction to the Structured Query Language SQL
 
Introduction to SQL, SQL*Plus
Introduction to SQL, SQL*PlusIntroduction to SQL, SQL*Plus
Introduction to SQL, SQL*Plus
 
Introduction to sql
Introduction to sqlIntroduction to sql
Introduction to sql
 
Sql basics
Sql  basicsSql  basics
Sql basics
 
PostgreSQL Tutorial For Beginners | Edureka
PostgreSQL Tutorial For Beginners | EdurekaPostgreSQL Tutorial For Beginners | Edureka
PostgreSQL Tutorial For Beginners | Edureka
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
Introduction to structured query language (sql)
Introduction to structured query language (sql)Introduction to structured query language (sql)
Introduction to structured query language (sql)
 
Android de la A a la Z XML Ulises Gonzalez
Android de la A a la Z  XML Ulises GonzalezAndroid de la A a la Z  XML Ulises Gonzalez
Android de la A a la Z XML Ulises Gonzalez
 
Introduction to-sql
Introduction to-sqlIntroduction to-sql
Introduction to-sql
 
Sql Server 2000
Sql Server 2000Sql Server 2000
Sql Server 2000
 
Basic SQL and History
 Basic SQL and History Basic SQL and History
Basic SQL and History
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 

Andere mochten auch

Using grouping sets in sql server 2008 tech republic
Using grouping sets in sql server 2008   tech republicUsing grouping sets in sql server 2008   tech republic
Using grouping sets in sql server 2008 tech republic
Kaing Menglieng
 
Sql tuning guideline
Sql tuning guidelineSql tuning guideline
Sql tuning guideline
Sidney Chen
 
e computer notes - Subqueries
e computer notes - Subqueriese computer notes - Subqueries
e computer notes - Subqueries
ecomputernotes
 
Triggers-Sequences-SQL
Triggers-Sequences-SQLTriggers-Sequences-SQL
Triggers-Sequences-SQL
Patrick Seery
 

Andere mochten auch (20)

SQL200.2 Module 2
SQL200.2 Module 2SQL200.2 Module 2
SQL200.2 Module 2
 
SQL202.3 Accelerated Introduction to SQL Using SQL Server Module 3
SQL202.3 Accelerated Introduction to SQL Using SQL Server Module 3SQL202.3 Accelerated Introduction to SQL Using SQL Server Module 3
SQL202.3 Accelerated Introduction to SQL Using SQL Server Module 3
 
Using grouping sets in sql server 2008 tech republic
Using grouping sets in sql server 2008   tech republicUsing grouping sets in sql server 2008   tech republic
Using grouping sets in sql server 2008 tech republic
 
Consultas en MS SQL Server 2012
Consultas en MS SQL Server 2012Consultas en MS SQL Server 2012
Consultas en MS SQL Server 2012
 
MS SQL SERVER: Creating Views
MS SQL SERVER: Creating ViewsMS SQL SERVER: Creating Views
MS SQL SERVER: Creating Views
 
Joins SQL Server
Joins SQL ServerJoins SQL Server
Joins SQL Server
 
Sql db optimization
Sql db optimizationSql db optimization
Sql db optimization
 
Sql xp 04
Sql xp 04Sql xp 04
Sql xp 04
 
Sql tuning guideline
Sql tuning guidelineSql tuning guideline
Sql tuning guideline
 
Statistics
StatisticsStatistics
Statistics
 
e computer notes - Subqueries
e computer notes - Subqueriese computer notes - Subqueries
e computer notes - Subqueries
 
Sub-queries,Groupby and having in SQL
Sub-queries,Groupby and having in SQLSub-queries,Groupby and having in SQL
Sub-queries,Groupby and having in SQL
 
Locking in SQL Server
Locking in SQL ServerLocking in SQL Server
Locking in SQL Server
 
Review of SQL
Review of SQLReview of SQL
Review of SQL
 
Triggers-Sequences-SQL
Triggers-Sequences-SQLTriggers-Sequences-SQL
Triggers-Sequences-SQL
 
"Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1
"Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1 "Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1
"Using Indexes in SQL Server 2008" by Alexander Korotkiy, part 1
 
Lecture 4. MS SQL. DML Triggers
Lecture 4. MS SQL. DML TriggersLecture 4. MS SQL. DML Triggers
Lecture 4. MS SQL. DML Triggers
 
Sql query analyzer & maintenance
Sql query analyzer & maintenanceSql query analyzer & maintenance
Sql query analyzer & maintenance
 
Locking And Concurrency
Locking And ConcurrencyLocking And Concurrency
Locking And Concurrency
 
SQL Server - Using Tools to Analyze Query Performance
SQL Server - Using Tools to Analyze Query PerformanceSQL Server - Using Tools to Analyze Query Performance
SQL Server - Using Tools to Analyze Query Performance
 

Ähnlich wie SQL202.1 Accelerated Introduction to SQL Using SQL Server Module 1

Ähnlich wie SQL202.1 Accelerated Introduction to SQL Using SQL Server Module 1 (20)

SQL200A Microsoft Access SQL Design
SQL200A Microsoft Access SQL DesignSQL200A Microsoft Access SQL Design
SQL200A Microsoft Access SQL Design
 
SQL200.3 Module 3
SQL200.3 Module 3SQL200.3 Module 3
SQL200.3 Module 3
 
SQL201S Accelerated Introduction to MySQL Queries
SQL201S Accelerated Introduction to MySQL QueriesSQL201S Accelerated Introduction to MySQL Queries
SQL201S Accelerated Introduction to MySQL Queries
 
SQL overview and software
SQL overview and softwareSQL overview and software
SQL overview and software
 
SQL, Embedded SQL, Dynamic SQL and SQLJ
SQL, Embedded SQL, Dynamic SQL and SQLJSQL, Embedded SQL, Dynamic SQL and SQLJ
SQL, Embedded SQL, Dynamic SQL and SQLJ
 
Sql
SqlSql
Sql
 
Migrate Microsoft Access to SQL Server
Migrate Microsoft Access to SQL ServerMigrate Microsoft Access to SQL Server
Migrate Microsoft Access to SQL Server
 
DBMS
DBMSDBMS
DBMS
 
Sql2008 (1)
Sql2008 (1)Sql2008 (1)
Sql2008 (1)
 
Module02
Module02Module02
Module02
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsOracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c  - New Features for Developers and DBAsOracle Database 12c  - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
Sq lite module5
Sq lite module5Sq lite module5
Sq lite module5
 
Introduction to Database SQL & PL/SQL
Introduction to Database SQL & PL/SQLIntroduction to Database SQL & PL/SQL
Introduction to Database SQL & PL/SQL
 
Die Neuheiten in MariaDB 10.2 und MaxScale 2.1
Die Neuheiten in MariaDB 10.2 und MaxScale 2.1Die Neuheiten in MariaDB 10.2 und MaxScale 2.1
Die Neuheiten in MariaDB 10.2 und MaxScale 2.1
 
MySQL intro
MySQL introMySQL intro
MySQL intro
 
MySQL intro
MySQL introMySQL intro
MySQL intro
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
 
SQL 3.pptx
SQL 3.pptxSQL 3.pptx
SQL 3.pptx
 
Advanced SQL - Database Access from Programming Languages
Advanced SQL - Database Access  from Programming LanguagesAdvanced SQL - Database Access  from Programming Languages
Advanced SQL - Database Access from Programming Languages
 

Mehr von Dan D'Urso

Course Catalog
Course CatalogCourse Catalog
Course Catalog
Dan D'Urso
 

Mehr von Dan D'Urso (20)

LCD201d Database Diagramming with Lucidchart
LCD201d Database Diagramming with LucidchartLCD201d Database Diagramming with Lucidchart
LCD201d Database Diagramming with Lucidchart
 
Database Normalization
Database NormalizationDatabase Normalization
Database Normalization
 
VIS201d Visio Database Diagramming
VIS201d Visio Database DiagrammingVIS201d Visio Database Diagramming
VIS201d Visio Database Diagramming
 
PRJ101a Project 2013 Accelerated
PRJ101a Project 2013 AcceleratedPRJ101a Project 2013 Accelerated
PRJ101a Project 2013 Accelerated
 
PRJ101xl Project Libre Basic Training
PRJ101xl Project Libre Basic TrainingPRJ101xl Project Libre Basic Training
PRJ101xl Project Libre Basic Training
 
Introduction to coding using Python
Introduction to coding using PythonIntroduction to coding using Python
Introduction to coding using Python
 
Stem conference
Stem conferenceStem conference
Stem conference
 
Microsoft access self joins
Microsoft access self joinsMicrosoft access self joins
Microsoft access self joins
 
SQL302 Intermediate SQL
SQL302 Intermediate SQLSQL302 Intermediate SQL
SQL302 Intermediate SQL
 
AIN106 Access Reporting and Analysis
AIN106 Access Reporting and AnalysisAIN106 Access Reporting and Analysis
AIN106 Access Reporting and Analysis
 
SQL302 Intermediate SQL Workshop 3
SQL302 Intermediate SQL Workshop 3SQL302 Intermediate SQL Workshop 3
SQL302 Intermediate SQL Workshop 3
 
SQL302 Intermediate SQL Workshop 2
SQL302 Intermediate SQL Workshop 2SQL302 Intermediate SQL Workshop 2
SQL302 Intermediate SQL Workshop 2
 
Course Catalog
Course CatalogCourse Catalog
Course Catalog
 
SQL302 Intermediate SQL Workshop 1
SQL302 Intermediate SQL Workshop 1SQL302 Intermediate SQL Workshop 1
SQL302 Intermediate SQL Workshop 1
 
SQL212 Oracle SQL Manual
SQL212 Oracle SQL ManualSQL212 Oracle SQL Manual
SQL212 Oracle SQL Manual
 
SQL201W MySQL SQL Manual
SQL201W MySQL SQL ManualSQL201W MySQL SQL Manual
SQL201W MySQL SQL Manual
 
AIN100
AIN100AIN100
AIN100
 
SQL206 SQL Median
SQL206 SQL MedianSQL206 SQL Median
SQL206 SQL Median
 
SQL202 SQL Server SQL Manual
SQL202 SQL Server SQL ManualSQL202 SQL Server SQL Manual
SQL202 SQL Server SQL Manual
 
AIN102 Microsoft Access Queries
AIN102 Microsoft Access QueriesAIN102 Microsoft Access Queries
AIN102 Microsoft Access Queries
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

SQL202.1 Accelerated Introduction to SQL Using SQL Server Module 1

  • 1. SQL200 SQL Programming Based on SQL Clearly Explained by Jan Harrington Module 1 – Relational Database Background, Basic Single Table Retrieval Operations Bookstore SQL200 Module 1
  • 2.
  • 3.
  • 4. SQL200 Contact Information Bookstore2 SQL200 Module 2 P.O. Box 6142 Laguna Niguel, CA 92607 949-489-1472 http://www.d2associates.com [email_address] Copyright 2001-2011. All rights reserved.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10. Bookstore SQL200 Module 1 Relational Database Table
  • 11.
  • 12. Bookstore SQL200 Module 1 Relational Database with constraints
  • 13. Database Management Systems Bookstore SQL200 Module 1 Positioning Chart VLDB Enterprise Workgroup Single user Spreadsheet # Users Cost
  • 14. System Architecture Bookstore SQL200 Module 1 Access MDB File Server Architecture Access
  • 15. System Architecture Bookstore SQL200 Module 1 Oracle DB Visual Basic App Client/Server Architecture Access  SQL 
  • 16. System Architecture Bookstore SQL200 Module 1 Oracle DB Browser Web Architecture Web Server  SQL 
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24. SQL Statement Processing Bookstore SQL200 Module 1 Parse Validate Optimize Access Plan Execute
  • 25.
  • 26.
  • 27.
  • 28. SELECT Bookstore SQL200 Module 1 Basic Syntax ( Projection ): Select <column-list> or <*> From <table-list>
  • 29. SELECT Bookstore SQL200 Module 1 Basic Example ( Projection ): select customer_last_name, customer_street from customers
  • 30. MS Access SQL Query Bookstore SQL200 Module 1
  • 31. Bookstore SQL200 Module 1
  • 32. SQL Server Query Bookstore SQL200 Module 1
  • 33. SELECT with Where Clause Bookstore SQL200 Module 1 Example ( Restriction plus Projection ): Select <column-list> From <table-list> Where <selection-criteria>;
  • 34.
  • 35. SELECT with Where Bookstore SQL200 Module 1 Basic Example ( Restriction plus Projection ): select customer_last_name, customer_street from customers where customer_last_name = ‘Jones’
  • 36. Select with Where Bookstore SQL200 Module 1
  • 37.
  • 38. Complex Predicates Bookstore SQL200 Module 1 Follow normal boolean logic Select customer_last_name, customer_street From customers Where (customer_last_name = ‘Jones’ or customer_last_name = ‘Smith’)and customer_state=‘NY’
  • 39. Select with Complex Where Bookstore SQL200 Module 1
  • 40. Complex Where Result Bookstore SQL200 Module 1
  • 41.
  • 42.
  • 43. IN Bookstore SQL200 Module 1 Select * From customers Where customer_last_name in (‘Rizzo’, ‘Jones’, ‘Garcia’) The list in parentheses can be replaced by a subquery. We will study this later.
  • 44. SQL Where Clause with IN Bookstore SQL200 Module 1
  • 45. IS NULL Bookstore SQL200 Module 1 Select * From customers Where customer_street IS NULL SQL uses three valued logic. Must use IS NULL to test for unknowns. A null is NOT the same as blank or empty.
  • 46.
  • 47. BETWEEN Bookstore SQL200 Module 1 Select * From orders Where order_date BETWEEN ‘1-Jan-99’ and ’31-Dec-99’ Note: date formats vary from product to product.
  • 48. Where with Between Bookstore SQL200 Module 1
  • 49. Removing Duplicates Bookstore SQL200 Module 1 Select DISTINCT customer_city From customers List once each city in which there are customers Removes duplicate rows from result set
  • 50. Removing Duplicates Bookstore SQL200 Module 1
  • 51. Sorting – ORDER BY Bookstore SQL200 Module 1 DESC will sort in descending order Basic syntax : Select <column list> From <table list> Where <selection criteria> Order by <column list> [DESC]
  • 52. Sorting – ORDER BY Bookstore SQL200 Module 1 Select * From customers Order by customer_state, customer_city Example: List all records sorted by state, city
  • 53. Sorting Results with Order By Bookstore SQL200 Module 1
  • 54. Selecting Top Records Bookstore SQL200 Module 1 Select Top 5 (or top 25 percent) Customer_last_name , contact_zip From customers Order by customer_zip desc ; List largest 5 zips or top 25 % of them…
  • 55.