Learning MySQL By Example
Introduction
1. How to Retrieve Data From a Single Table
1.1. The Five Clauses of the SELECT Statement
1.2. Column Specifications
1.3. LIKE and REGEXP Operators
1.4. Arithmetic Operators
1.5. Column Aliases
1.6. Comparison Operators
1.7. IS NULL, BETWEEN, IN Operators
1.8. AND, OR, NOT Logical Operators
1.9. DISTINCT Clause
2. How to Retrieve Data from Multiple Tables
2.1. The JOIN Clause
2.2. Joining More Than Two Tables
2.3. The OUTER JOIN Clause
2.4. How to Code a UNION
3. Using Functions
3.1. Date Functions
3.2. Numeric Functions
3.3. String Functions
4. How to Insert, Update, Delete Data in Tables
4.1. The INSERT Clause With a Column List
4.2. The INSERT Clause Without a Column List
4.4. The UPDATE Clause With a Column List
4.4. The DELETE Clause
5. Summary Queries and Aggregate Functions
5.1. Aggregate Functions
5.2. Grouping Data
5.3. Simple GROUP BY Query
5.4. Improving the GROUP BY Query
5.5. Using the HAVING Clause
5.5. Using the HAVING and WHERE Clauses Together
5.6. COUNT(column_name) and COUNT(*)
5.7. Using the DISTINCT Statement
6. Working With Subqueries
6.1. The Subquery In a SELECT Statement
6.2. The Subquery in an UPDATE statement
6.3. Create a Duplicate Table From An Existing Table
6.4. The Subquery In a Delete Statement
7. SQL Views
7.1. SQL View Explained
7.2. Benefits of Using Views
7.3. Views That Allow UPDATE Statements
8. SQL Indexes
8.1. SQL Indexes Explained
8.2. Clustered vs. Non-clustered Indexes
8.3. Create an Index in Workbench Using an ERD
8.4. How to Manually Add an Index to an Existing Table
Glossary
Index
Close
Images
References
Abstracts
Download
Endorsements
Front Matter
Search
Summaries
Sign in
Close
Search
Choose a Sign-in Option
Tools and Settings
Abstracts
Download
Endorsements
Front Matter
Search
Summaries
Content
Introduction
How to Retrieve Data From a Single Table
The Five Clauses of the SELECT Statement
Column Specifications
LIKE and REGEXP Operators
Arithmetic Operators
Column Aliases
Comparison Operators
IS NULL, BETWEEN, IN Operators
AND, OR, NOT Logical Operators
DISTINCT Clause
How to Retrieve Data from Multiple Tables
The JOIN Clause
Joining More Than Two Tables
The OUTER JOIN Clause
How to Code a UNION
Using Functions
Date Functions
Numeric Functions
String Functions
How to Insert, Update, Delete Data in Tables
The INSERT Clause With a Column List
The INSERT Clause Without a Column List
The UPDATE Clause With a Column List
The DELETE Clause
Summary Queries and Aggregate Functions
Aggregate Functions
Grouping Data
Simple GROUP BY Query
Improving the GROUP BY Query
Using the HAVING Clause
Using the HAVING and WHERE Clauses Together
COUNT(column_name) and COUNT(*)
Using the DISTINCT Statement
Working With Subqueries
The Subquery In a SELECT Statement
The Subquery in an UPDATE statement
Create a Duplicate Table From An Existing Table
The Subquery In a Delete Statement
SQL Views
SQL View Explained
Benefits of Using Views
Views That Allow UPDATE Statements
SQL Indexes
SQL Indexes Explained
Clustered vs. Non-clustered Indexes
Create an Index in Workbench Using an ERD
How to Manually Add an Index to an Existing Table
Glossary
Index
Search within this publication
Search the entire site
Questions and Tasks
Download the publication as a PDF.
Endorse this publication.
Read a summary of all chapters.
Search within this book's content.
Submit your own content to the publication.
Close
Search
Search
7.2. Benefits of Using Views
… country_nameFROM city ci
join
country co ON ci.CountryCode = co.Code;
join
country co
2.4. How to Code a UNION
1. How to Retrieve Data From a Single Table
5.4. Improving the GROUP BY Query
… List Price'FROM product p
join
category c ON p.category_id = c.category_idGROUP…
join
category c
2.2. Joining More Than Two Tables
… FROM city ci6
join
country co 7 ON ci.CountryCode…
join
countrylanguage cl.
How to
join
More than Two Tables
8.1. SQL Indexes Explained
1.1. The Five Clauses of the SELECT Statement
2.1. The JOIN Clause
… a SQL statement with an inner
join
clause using explicit syntax.
… FROM country 6
join
city 5 ON city.CountryCode…
… more succinctly with an inner
join
clause using table aliases. Instead of…
… FROM city ci 5
join
country co 6 ON ci.CountryCode…
The results of the
join
query would yield the same results as shown below whether…
join
country co
The
join
Clause
2.3. The OUTER JOIN Clause
… a SQL statement with an outer
join
clause.
… cl.language3 FROM country c LEFT
join
countrylanguage cl4 ON c.code = cl.CountryCode5…
FROM country c LEFT
join
countrylanguage cl
The Outer
join
Clause
6.4. The Subquery In a Delete Statement