SitePoint
Blog
Forum
Library
Login
Join Premium
Toggle sidebar
Simply SQL
Toggle community discussions
Close
Content
Files
Bookmarks
Preface
Simply SQL
Notice of Rights
Notice of Liability
Trademark Notice
About the Author
About the Expert Reviewer
About the Technical Editors
About SitePoint
Who Should Read This Book?
The Challenges to Learning SQL
What’s in This Book?
How to Gain Help
The SitePoint Newsletters
Your Feedback
Conventions Used in This Book
Acknowledgments
1
An Introduction to SQL
SQL Statement Overview
Data Definition Language
Data Manipulation Language
Wrapping Up: an Introduction to SQL
An Overview of the SELECT Statement
The SELECT Statement
The SELECT and FROM Clauses
The WHERE Clause
The GROUP BY and HAVING Clauses
The ORDER BY Clause
Wrapping Up: the SELECT Statement
The FROM Clause
Why Start with the FROM Clause?
FROM One Table
FROM more than One Table Using JOINs
Real World Joins
Views
Subqueries and Derived Tables
Wrapping Up: the FROM Clause
The WHERE Clause
Conditions
Shopping Carts
Operators
Compound Conditions with AND and OR
IN Conditions
Correlated Subqueries
EXISTS Conditions
WHERE Clause Performance
Wrapping Up: the WHERE Clause
The GROUP BY Clause
Grouping is More than Sequencing
Out of Many, One
How GROUP BY Works
Rules for GROUP BY
Wrapping Up: the GROUP BY
The HAVING Clause
HAVING Filters Group Rows
Wrapping Up: the HAVING Clause
The SELECT Clause
SELECT in the Sequence of Execution
Which Columns Can Be Selected?
The Discussion Forum Application
Functions
Operators
The Dreaded, Evil Select Star
Wrapping Up: the SELECT Clause
The ORDER BY Clause
ORDER BY Syntax
How ORDER BY Works
The Scope of ORDER BY
Wrapping Up: the ORDER BY Clause
SQL Data Types
An Overview of Data Types
Numeric Data Types
Character Data Types
Temporal Data Types
Column Constraints
Wrapping Up: SQL Data Types
Relational Integrity
Identity
Data Modelling
Primary Keys
UNIQUE Constraints
Foreign Keys
Natural versus Surrogate Keys
Wrapping Up: Relational Integrity
Special Structures
Joining to a Table Twice
Joining a Table to Itself
Implementing a Many-to-many Relationship: Keywords
Wrapping Up: Special Structures
Appendices
Appendix A. Testing Environment
Appendix B. Sample Applications
Appendix C. Sample Scripts
Appendix D. SQL Keywords
Index
Open text modal
Community Questions
Close