SQL Keywords

Back to home
Logicmojo - Updated Aug 28, 2021



SQL Keywords Reference

The reserved terms in SQL are listed in this SQL keywords reference.

KeywordDescription
ADD In an existing table, adds a column.
ADD CONSTRAINTSAfter a table has been established, adds a constraint.
ALLChanges the data type of a column in a table or adds, deletes, or edits columns in a table.
ALTERA table's columns can be added, deleted, or modified.
ALTER COLUMNOnly rows where both requirements are true are included.
ALTER TABLEIf any of the subquery items fit the requirement, this function returns true.
ANDAn alias is used to rename a column or table.
ANYSorts the result set from top to bottom in ascending order.
ASCreates a database backup from an existing one.
ASCA table column's data type is changed.
BACKUP DATABASEA table column's data type is changed.
BETWEEN Selects values from a specified range.
CASEDepending on the conditions, different outcomes are generated.
CHECKA constraint that restricts the amount of data that can be entered into a column.
COLUMNChanges a column's data type or deletes a column in a table.
CONSTRAINTSA constraint can be added or removed.
CREATEA database, index, view, table, or process is created.
CREATE DATABASEThis command creates a new SQL database.
CREATE INDEXCreates a table's index (allows duplicate values)
CREATE OR REPLACE VIEWUpdates the state of a view.
CREATE TABLEIn the database, creates a new table.
CREATE PROCEDUREThis function creates a stored procedure.
CREATE UNIQUE INDEXCreates a one-of-a-kind index for a table (no duplicate values)
CREATE VIEWCreates a view from a SELECT statement's result set.
DATABASEThis command creates or deletes a SQL database.
DEFAULTA constraint that sets a column's default value.
DELETERows from a table are deleted.
DESCStored in descending order.
DISTINCTOnly distinct (different) values are chosen.
DROPRemoves a column, constraint, database, index, table, or view from a table or view.
DROP COLUMNA UNIQUE, PRIMARY KEY, FOREIGN KEY, or CHECK constraint is removed from a table.
DROP CONSTRAINTSA DEFAULT constraint is removed.
DROP DATABASEDeletes a SQL database that already exists.
DROP DEFAULTRemoves an existing database table.
DROP INDEXRemoves a table's index.
DROP TABLERemoves an existing database table.
DROP VIEWRemoves a view from the list.
EXECThis function runs a stored process.
EXISTSIn a subquery, this function checks for the existence of any record.
FOREIGN KEYA constraint is a key that is used to connect two tables.
FROMSelects or deletes data from a certain table.
FULL OUTER JOINWhen there is a match in either the left or right table, it returns all rows.
GROUP BYThe result set is divided into groups (used with aggregate functions: COUNT, MAX, MIN, SUM, AVG)
HAVINGWith aggregate functions, this is used instead of WHERE.
INIn a WHERE clause, you can specify several values.
INDEXIn a table, creates or deletes an index.
INNER JOINReturns rows with values in both tables that are the same.
INSERT INTOAdds new rows to a table.
INSERT INTO SELECTCopies information from one table to another.
IS NULLEmpty values or decreasing order are checked.
IS NOT NULLNon-empty values are checked.
JOINTables are joined.
LEFT JOINAll rows from the left table are returned, as well as the corresponding rows from the right table.
LIKEIn a column, looks for a specific pattern.
LIMITThe number of records to return in the result set is specified here.
NOTOnly rows where a condition is false are included.
NOT NULLA constraint that prevents NULL values from being entered in a column.
ORRows where either criterion is true are included.
ORDER BYSorts the result set from top to bottom in ascending or descending order.
OUTER JOINWhen there is a match in either the left or right table, it returns all rows.
PRIMARY KEYA restriction that allows each record in a database table to be uniquely identified.
PROCEDUREA procedure that has been saved.
RIGHT JOINAll rows from the right table are returned, as well as the matching rows from the left table.
ROWNUMThe number of records to return in the result set is specified here.
SELECTObtains information from a database.
SELECT DISTINCTOnly distinct (different) values are chosen.
SELECT INTOCopies information from one table to another.
SELECT TOPThe number of records to return in the result set is specified here.
SETIndicates which columns and values in a table should be changed.
TABLECreates a table, or adds, deletes, or alters columns in a table, or deletes a table or the data it contains.
TOPThe number of records to return in the result set is specified here.
TRUNCATE TABLEThe data in a table is deleted, but not the table itself.
UNIONCombines the results of two or more SELECT operations into a single result set (ONLY DISTINCT values)
UNION ALLCombines the results of two or more SELECT operations into a single result set (allows duplicate values)
UNIQUEA restriction that ensures each column's values are unique.
UPDATEExisting rows in a table are updated.
VALUESThe values of an INSERT INTO statement are specified here.
VIEWA view is created, updated, or deleted.
WHEREFilters a result set to only contain records that meet a set of criteria.



With this article at Logicmojo, you must have the complete idea of SQL Keywords.