Getting started with SQL and Databases

Số trang: 380      Loại file: pdf      Dung lượng: 2.82 MB      Lượt xem: 539      Lượt tải: 0

Thành viên thường xem thêm

Thông tin tài liệu

T able of Contents
Chapter 1:  Starting with SQL
Basic SELECT Statement
Case Sensitivity
Spacing
Clause Ordering
The Semicolon (;)
Selecting Specific Columns
Column Order
Layout
Using SELECT *
Calculated Columns
Aliases
Comments
Block Comments
Uses of Comments
Filtering Rows
Clause Ordering
Placing the Semicolon
Ordering the Results
Clause Order
Distinct Rows
Summary
Writing SQL
Columns
Comments
Filtering Data
Row Order
Clause Order
Coming Up
Chapter 2:  Database
About the Sample Database
Database
T ables
Normalized T ables
Multiple V alues
Summary
Coming Up
Chapter 3:  Filtering Data
The WHERE Clause
Unrelated Assertions
All and Nothing
Dealing with NULL
Deliberately Ignoring NULLs
Finding NULLs
Numbers
Discrete vs.  Continuous V alues
Strings
Quotes
More on MySQL/  MariaDB Modes
More on Double and Single Quotes
Case Sensitivity
T railing Spaces
Filtering with String Functions
Handling Quotes and Apostrophes
Before and After Strings
Dates
Dates Are Not Strings
Alternative Date Formats
Date Comparisons
Filtering with a Date Calculation
Multiple Assertions
AND and OR
The IN Operator
Derived Lists
Wildcard Matches
Case Sensitivity and Patterns
Pattern Characters
Wildcards with Non-strings
Extensions to Wildcards
A Simple Pattern Match Example
Summary
NULL
Numbers
Strings
Dates
Multiple Assertions
The IN Operator
Wildcard Matches
Coming Up
Chapter 4:  Ordering Results
Using the ORDER BY Clause
Sort Direction
Missing Data (NULL)
Data T ypes
Case Sensitivity and Collation
Multiple Columns
Interdependence of Columns
Sort Direction on Multiple Columns
Sorting by Calculated Columns
Limiting the Number of Results
Paging
Using LIMIT … OFFSET … (MySQL/  MariaDB, SQLite, and
PostgreSQL)
Using TOP (MSSQL)
Fetching a Random Row
Nonalphabetical String Order
Special Strings
Summary
Sorting with ORDER BY
Limiting Results
Sorting Strings
Coming Up
Chapter 5:  Calculating Column V alues
T esting Calculations
Emulating V ariables
Some Basic Calculations
Basic Number Calculations
Basic String Calculations
Basic Date Calculations
Working with NULL
Using Aliases
Aliases Without AS
A wkward Aliases
Calculating with Numbers
Arithmetic Operators
Integers
Remainder
Extra Decimals
Mathematical Functions
Approximation Functions
Formatting Functions
Calculating with Dates
Simple Calculations
Age Calculations
Extracting Parts of a Date
Formatting a Date
Strings
Character Functions
Subqueries
The CASE Expression
Casting to Different Data T ypes
The cast( ) Function
Casting to a String
Casting Date Literals
Creating a View
Using Views in Microsoft SQL
Summary
Data T ypes
NULLs
Aliases
Subqueries
The CASE Expression
Casting a V alue
Views
Coming Up
Chapter 6:  Joining T ables
How a Join Works
Joining the T ables
Alternative Syntax
Selecting the Results
T able Aliases
Developing a Price List
Join T ypes
The INNER JOIN
The LEFT OUTER JOIN and RIGHT OUTER JOIN
The “Preferred” Outer Join
Some Recommendations on JOINS
Finishing the Price List
Joining Many T ables
Building a Larger JOIN
Revisiting Some Subqueries
A More Complex Join
Using a Self-Join
Summary
Syntax
T able Aliases
The ON Clause
Join T ypes
Coming Up
Chapter 7:  Aggregating Data
Counting Data
Counting V alues
How Aggregates W ork
Counting Selectively
Distinct V alues
Summarizing Numbers
Bad Examples
Scales of Measurement
Aggregating Calculated Data
Other Aggregate Functions
Using Aggregates As Filters
Xem thêm


Giao dịch viên QHKH Cá nhân-RM Hỗ trợ tín dụng Thực tập sinh Agribank - NH Nông nghiệp & PTNT BIDV - NH Đầu tư phát triển VN Vietinbank - NH Công thương VN Vietcombank (VCB) - NH Ngoại thương VN LienVietPost Bank (LVPB) - NH Bưu Điện Liên Việt MB Bank - NH Quân Đội Techcombank - NH Kỹ Thương Tổng cục Thống kê
Nhắn cho chúng tôi