Practical sql: a beginner’s Guide to Storytelling with Data pdfdrive com



tải về 5.77 Mb.
Chế độ xem pdf
trang4/267
Chuyển đổi dữ liệu06.01.2024
Kích5.77 Mb.
#56244
1   2   3   4   5   6   7   8   9   ...   267
Practical SQL A Beginner’s Guide

5
BASIC MATH AND STATS WITH SQL
Math Operators
Math and Data Types
Adding, Subtracting, and Multiplying
Division and Modulo
Exponents, Roots, and Factorials
Minding the Order of Operations
Doing Math Across Census Table Columns
Adding and Subtracting Columns
Finding Percentages of the Whole
Tracking Percent Change
Aggregate Functions for Averages and Sums
Finding the Median
Finding the Median with Percentile Functions
Median and Percentiles with Census Data
Finding Other Quantiles with Percentile Functions
Creating a median() Function
Finding the Mode
Wrapping Up
Try It Yourself


6
JOINING TABLES IN A RELATIONAL DATABASE
Linking Tables Using JOIN
Relating Tables with Key Columns
Querying Multiple Tables Using JOIN
JOIN Types
JOIN
LEFT JOIN and RIGHT JOIN
FULL OUTER JOIN
CROSS JOIN
Using NULL to Find Rows with Missing Values
Three Types of Table Relationships
One-to-One Relationship
One-to-Many Relationship
Many-to-Many Relationship
Selecting Specific Columns in a Join
Simplifying JOIN Syntax with Table Aliases
Joining Multiple Tables
Performing Math on Joined Table Columns
Wrapping Up
Try It Yourself
7
TABLE DESIGN THAT WORKS FOR YOU
Naming Tables, Columns, and Other Identifiers
Using Quotes Around Identifiers to Enable Mixed Case
Pitfalls with Quoting Identifiers
Guidelines for Naming Identifiers
Controlling Column Values with Constraints
Primary Keys: Natural vs. Surrogate
Foreign Keys
Automatically Deleting Related Records with CASCADE
The CHECK Constraint
The UNIQUE Constraint


The NOT NULL Constraint
Removing Constraints or Adding Them Later
Speeding Up Queries with Indexes
B-Tree: PostgreSQL’s Default Index
Considerations When Using Indexes
Wrapping Up
Try It Yourself

tải về 5.77 Mb.

Chia sẻ với bạn bè của bạn:
1   2   3   4   5   6   7   8   9   ...   267




Cơ sở dữ liệu được bảo vệ bởi bản quyền ©hocday.com 2024
được sử dụng cho việc quản lý

    Quê hương