Reading Tables: The SELECT Query
The most common operation in a database is reading data from a database. This is almost exclusively done through the use of the
Basic Anatomy and Working of a SELECT Query
Generally speaking, a query can be broken down into five parts:
- Operation: The first part of a query describes what is going to be done. In this case, this is the word
SELECT, followed by the names of columns combined with functions.
- Data: The next part of the query is the data, which is the
FROMkeyword followed by one or more tables connected together with reserved keywords indicating what data should be scanned for filtering, selection, and calculation.
- Conditional: A part of the query that filters the data to only rows that meet a condition usually indicated with
- Grouping: A special clause that takes the rows of a data source, assembles them together using a key created by a
GROUP BYclause, and then calculates a value using...