- Tags: Keyword
- Categories: Reference, SQL Reference, SQL Resources
Quick Reference
This is a quick reference list of SQL keywords and how they are used to write SQL statements.
SQL – ADD Keyword
The ADD keyword is used to add columns or constraints to an existing table.
SQL – ALL Keyword
The ALL keyword returns true if all of the subquery conditions are met.
SQL – ALTER Keyword
The ALTER keyword adds, deletes, or modifies columns in a table. It can also add and delete various constraints in a table.
SQL – AND Keyword
The AND keyword is used with the WHERE keyword to only include rows where both conditions is true.
SQL – ANY Keyword
The ANY keyword returns true if any of the subquery conditions are met.
SQL – AS Keyword
The AS keyword is used to output a column or table with a temporary alias for the duration of the query. Nothing in the database itself is altered.
SQL – ASC Keyword
The ASC keyword is used to sort the returned data in ascending order (A – Z).
SQL – BACKUP DATABASE Keywords
The BACKUP DATABASE keywords are used in SQL Server to create a full back up of an existing SQL database.
SQL – BETWEEN Keyword
The BETWEEN keyword is used to select values (numbers, text, or dates) within a given range (inclusively).
SQL – CASE Keyword
The CASE keyword is used is to create different output based on various conditions.
SQL – CHECK Keyword
The CHECK keyword is a constraint that limits the value that can be placed in a column.
SQL – COLUMN Keyword
The COLUMN keyword is used to change the data type of a column or delete a column in a table.
SQL – CONSTRAINT Keyword
The CONSTRAINT keyword is used to create or delete a constraint from an existing table.
SQL – CREATE Keyword
The CREATE keyword is used to create new databases, indexes, procedures, tables, and views.
SQL – DATABASE Keyword
The DATABASE keyword is used to create a new SQL database or delete an existing SQL database.
SQL – DEFAULT Keyword
The DEFAULT keyword provides a default value for a column that will be added to all new records if no other value is specified.
SQL – DELETE Keyword
The DELETE keyword is used to delete existing records in a table.
SQL – DESC Keyword
The DESC keyword is used to sort the returned data in descending order (Z – A).
SQL – DISTINCT Keyword
The DISTINCT keyword returns only different values (no two values the same) in the result set.
SQL – EXEC Keyword
The EXEC keyword is used to execute a stored procedure.
SQL – EXISTS Keyword
The EXISTS keyword tests for the existence of any record in a subquery, and returns “true” if the subquery returns one or more records.
SQL – FOREIGN KEY Keywords
The FOREIGN KEY keywords are a key (a field or fields in one table that refers to the PRIMARY KEY in another table) used to link two tables together.
SQL – FROM Keyword
The FROM keyword is used to specify which table to select or delete data from.
SQL – FULL OUTER JOIN Keywords
The FULL OUTER JOIN keyword returns all rows when there is a match in either the left table or right table.
SQL – GROUP BY Keywords
The GROUP BY keywords are used to group the result set (used with aggregate functions: COUNT, MAX, MIN, SUM, AVG).
SQL – HAVING Keyword
The HAVING keyword is used instead of WHERE with aggregate functions.
SQL – INDEX Keyword
Indexes are used to speed up the retrieval of data (searches/queries) from the database.
SQL – INNER JOIN Keywords
The INNER JOIN keywords returns rows that have matching values in both tables.
SQL – INSERT INTO Keywords
The INSERT INTO statement is used to insert new records in a table.
SQL – INSERT INTO SELECT Keywords
The INSERT INTO SELECT keywords copies data from one table and inserts it into another table.
SQL – IS NOT NULL Keywords
The IS NOT NULL keywords are used to test for non-empty values (NOT NULL values).
SQL – IS NULL Keywords
The IS NULL keywords are used to test for empty values (NULL values).
SQL – JOIN Keyword
The JOIN keyword is used in an INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL OUTER JOIN to return matching rows from two tables.
SQL – LEFT JOIN Keywords
The LEFT JOIN keywords return all rows from the left table, and the matching rows from the right table (NULL from the right side if there is no match).
SQL – LIKE Keyword
The LIKE keyword is used in a WHERE clause to search for a specified pattern in a column. It can use two wildcards: % and _.
SQL – LIMIT Keyword
The LIMIT keyword is used to specify the number of records to return (MySQL).
SQL – NOT Keyword
The NOT keyword is used with other SQL keywords to only include rows where a condition is NOT true.
SQL – NOT NULL Keywords
The NOT NULL keywords enforces a column to NOT accept NULL values (a record cannot be inserted/updated without adding a value to that field).
SQL – OR Keyword
The OR keyword is used with the WHERE keyword to include rows where at least one of multiple conditions are true.
SQL – ORDER BY Keywords
The ORDER BY keywords are used to sort the result set using a specified column in ascending order (A – Z) or descending (Z – A) order.
SQL – PRIMARY KEY Keywords
The PRIMARY KEY keywords uniquely identifies each record in a table, which can have only one primary key consisting of a single field or multiple fields.
SQL – PROCEDURE Keyword
The PROCEDURE keyword is used with the CREATE keyword to create a stored procedure (prepared SQL code to be reused many times).
SQL – RIGHT JOIN Keywords
The RIGHT JOIN keywords returns all rows from the right table, and the matching rows from the left table (NULL from the left side if there is no match).
SQL – SELECT Keyword
The SELECT keyword is used to select specified data from a database.
SQL – SELECT INTO Keywords
The SELECT INTO keywords copies data from one table and inserts it into another table.
SQL – SET Keyword
The SET keyword is used with UPDATE to specify which columns and values should be updated in a table.
SQL – TOP Keyword
The TOP keyword is used to specify the number of records to return (SQL Server).
SQL – TRUNCATE TABLE Keywords
The TRUNCATE TABLE keywords deletes all the data inside a table, but not the table itself.
SQL – UNION Keyword
The UNION keyword combines the result set of two or more SELECT statements (returning only distinct values).
SQL – UNION ALL Keywords
The UNION ALL keywords combines the result set of two or more SELECT statements (will return duplicate values).
SQL – UNIQUE Keyword
The UNIQUE keyword ensures that all values in a column are unique.
SQL – UPDATE Keyword
The UPDATE keyword is used to update existing rows in a table.
SQL – USE Keyword
The USE keyword specifies the database you intend to work with. The statement is often made when starting work on or switching to a particular database.
SQL – VALUES Keyword
The VALUES keyword specifies the values in an INSERT INTO statement.
SQL – VIEW Keyword
The VIEW keyword is used to CREATE a virtual table based on the result set of an SQL statement.
SQL – WHERE Keyword
The WHERE keyword filters a result set to include only records that fulfill a specified condition or set of conditions.
We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.
Why 1SMARTchicken?
See More →
Thanks for your support!
SQL Books
All are affiliate links. Thank you for your support!
SQL NOTES:
- Any work being done to modify the structure of a database or delete tables or the the database itself should only be done after making a recent backup
Feedback
If you see an error on the page or the code itself is incorrect or incomplete, or just plain wrong, please let us know. We’re always learning. NOTE: we do not sell your information and will not send you spam emails.