SQL Server Tutorial SQL Server Advanced SQL Server Database SQL Server References

SQL Server - Keywords



Keywords are reserved words and SQL Server (Transact-SQL) has a number of keywords that are available while working on a database. A list of these keywords with brief description are mentioned below. For more details about any keyword, please visit its page.

SQL Server Keywords

KeywordDescription
ADD Adds a column in an existing table.
ADD CONSTRAINT Adds a constraint after a table is already created.
ALTER Adds, deletes, or modifies columns in a table, or changes the data type of a column in a table.
ALTER COLUMN Changes the data type of a column in a table.
ALTER TABLE Adds, deletes, or modifies columns in an existing table.
ALL Returns true if all of the subquery values satisfies the condition.
AND Combines multiple conditions and include a record if all the conditions separated by AND keyword are true.
ANY Returns true if any of the subquery values satisfies the condition.
AS Renames a column or table with an alias.
ASC Sorts the result set in ascending order.
BETWEEN Specify a range in SQL Server statement.
CASE Creates different outputs based on conditions.
CHECK A constraint to ensures that all values in a column of a table satisfies specified condition.
COLUMN Changes the data type of a column or deletes a column in a table.
CONSTRAINT Adds or deletes a constraint.
CREATE DATABASE Creates a new SQL Server database.
CREATE INDEX Creates an index on a table (allows duplicate values).
CREATE OR ALTER VIEW Updates a view.
CREATE TABLE Creates a new table in the database.
CREATE UNIQUE INDEX Creates a unique index on a table (no duplicate values).
CREATE VIEW Creates a view based on a SELECT statement.
DEFAULT A constraint used to set the default value for a column.
DELETE Deletes the existing records from a table.
DESC Sorts the result set in descending order.
DISTINCT Selects only distinct (different) values from the database.
DROP Deletes a column, constraint, database, index, table, or view.
DROP COLUMN Deletes a column in a table.
DROP CONSTRAINT Deletes a UNIQUE, PRIMARY KEY, FOREIGN KEY, or CHECK constraint.
DROP DATABASE Deletes an existing SQL Server database.
DROP DEFAULT Deletes a DEFAULT constraint.
DROP INDEX Deletes an index on a table.
DROP TABLE Deletes an existing table from the database.
DROP VIEW Deletes a view.
EXCEPT Returns all records from the first result-set that do not appear in the second result-set.
EXISTS Tests for the existence of records from a subquery.
FOREIGN KEY A constraint that is a key used to link two tables together.
FROM Specifies which table to select or delete data from
FULL JOIN Returns all rows from both of the tables when there is a match in either left table or right table.
FULL OUTER JOIN Returns all rows from both of the tables when there is a match in either left table or right table.
GROUP BY Arrange the result table into identical groups (used with aggregate functions: COUNT, MAX, MIN, SUM, AVG).
HAVING Specify conditions with aggregate functions.
IN Specify multiple values with a SQL Server WHERE clause.
INDEX Creates or deletes an index on a table.
INNER JOIN Returns all rows from both of the tables when there is a match between the columns.
INSERT INTO Inserts a new record in a table.
INSERT INTO SELECT Copies data from one table into another table
INTERSECT Returns the intersection of result-set of two or more SELECT statements.
IS NULL Tests for empty values of a field.
IS NOT NULL Tests for non-empty values of a field.
JOIN Joins rows of two or more tables based on common column between them.
LEFT JOIN Returns all rows of the left table and matching rows of the right table.
LEFT OUTER JOIN Returns all rows of the left table and matching rows of the right table.
LIKE Search for a specified pattern in a specified column.
NOT Include a record where the specified condition is not true.
NOT LIKE Negation of LIKE.
NOT NULL A constraint that enforces a column to not accept NULL values.
OR Combines multiple conditions and include a record if any of the conditions separated by OR keyword is true.
ORDER BY Sorts the result table in ascending or descending order.
PRIMARY KEY A constraint that ensures that all values in a column are unique and not null.
RIGHT JOIN Returns all rows of the right table and matching rows of the left table.
RIGHT OUTER JOIN Returns all rows of the right table and matching rows of the left table.
SELECT Selects data from a database.
SELECT DISTINCT Selects only distinct (different) values from a database.
SELECT INTO Copies data from one table into a new table
SELECT TOP Specifies number or percentage of records to fetch from a table.
SET Specifies which columns and values that should be updated in a table.
SOME Returns true if any of the subquery values satisfies the condition.
TOP Specifies number or percentage of records to fetch from a table.
TRUNCATE TABLE Deletes the complete data from an existing table, but not the table itself.
UNION Combines the result set of two or more SELECT statements (only distinct values).
UNION ALL Combines the result set of two or more SELECT statements (allows duplicate values).
UNIQUE A constraint that ensures that all values in a column are unique.
UPDATE Updates the existing records in a table.
VALUES Specifies the values of an INSERT INTO statement
VIEW Creates, updates, or deletes a view
WHERE Filters a result set to include only records that fulfill a specified condition