Introduction to T-SQL
T-SQL is the language SQL Server speaks. You will ask your first questions of a database with SELECT, choose and calculate columns, sort and limit results, and filter rows with WHERE.
Updated
SELECT in T-SQL
- SELECT in T-SQL: an overview (Novice): A SELECT statement asks the database a question and gets back a table of answers; T-SQL is SQL Server's version of SQL.
- SELECT Query Structure (Novice): A SELECT statement is built from clauses that always appear in the same order; this chapter uses SELECT, FROM, WHERE and ORDER BY.
- Simple SELECT Query (Novice): SELECT * FROM a table returns every column and every row, the quickest way to see what a table holds.
- Specifying Columns (Novice): List the columns you want, in the order you want them, and rename them in the result with AS.
- Calculations in Columns (Apprentice): Work out new values as you query, with arithmetic on a row's columns and joined text, and give each calculated column a name.
- TOP and ORDER BY (Novice): Sort a query's results with ORDER BY, ascending or descending, by one column or several, and keep only the first rows with TOP.
WHERE in T-SQL
- WHERE in T-SQL: an overview (Novice): A WHERE clause keeps only the rows that match a condition, such as the customers in one country.
- Types of Filters (Apprentice): Filter numbers and dates with comparison operators, text with LIKE patterns, lists with IN, ranges with BETWEEN, and missing values with IS NULL.
- Using Multiple Condition Filters (Apprentice): Combine conditions in a WHERE clause with AND, OR and NOT, and use parentheses so they're checked the way you mean.