Minor updates to Chapters 2 and 3 code files.
This commit is contained in:
parent
7189b2c405
commit
b1c0a13dfc
@ -1,9 +1,9 @@
|
|||||||
--------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
-- Practical SQL: A Beginner's Guide to Storytelling with Data
|
-- Practical SQL: A Beginner's Guide to Storytelling with Data, 2nd Edition
|
||||||
-- by Anthony DeBarros
|
-- by Anthony DeBarros
|
||||||
|
|
||||||
-- Chapter 2 Code Examples
|
-- Chapter 2 Code Examples
|
||||||
--------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
|
|
||||||
-- Listing 2-1: Creating a database named analysis
|
-- Listing 2-1: Creating a database named analysis
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
--------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
-- Practical SQL: A Beginner's Guide to Storytelling with Data
|
-- Practical SQL: A Beginner's Guide to Storytelling with Data, 2nd Edition
|
||||||
-- by Anthony DeBarros
|
-- by Anthony DeBarros
|
||||||
|
|
||||||
-- Chapter 3 Code Examples
|
-- Chapter 3 Code Examples
|
||||||
--------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
|
|
||||||
-- Listing 3-1: Querying all rows and columns from the teachers table
|
-- Listing 3-1: Querying all rows and columns from the teachers table
|
||||||
|
|
||||||
@ -96,6 +96,15 @@ FROM teachers
|
|||||||
WHERE school = 'F.D. Roosevelt HS'
|
WHERE school = 'F.D. Roosevelt HS'
|
||||||
AND (salary < 38000 OR salary > 40000);
|
AND (salary < 38000 OR salary > 40000);
|
||||||
|
|
||||||
|
-- Note how the results change if we omit parentheses. That's
|
||||||
|
-- because the AND operator takes precedence over OR and is
|
||||||
|
-- evaluated first:
|
||||||
|
|
||||||
|
SELECT *
|
||||||
|
FROM teachers
|
||||||
|
WHERE school = 'F.D. Roosevelt HS'
|
||||||
|
AND salary < 38000 OR salary > 40000;
|
||||||
|
|
||||||
-- Listing 3-10: A SELECT statement including WHERE and ORDER BY
|
-- Listing 3-10: A SELECT statement including WHERE and ORDER BY
|
||||||
|
|
||||||
SELECT first_name, last_name, school, hire_date, salary
|
SELECT first_name, last_name, school, hire_date, salary
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user