Guide.
SQL is a domain-specific programming language designed for managing and communicating
with data held in a relational database management system
SQL is used for: -creating databases
-adding, modifying and deleting database structures
-inserting, deleting and modifying records in databases
-querying databases
Data Definition Language (DDL) used to create and modify the structure of the database example:
CREATE ALTER or DROP
Data Manipulation Language (DML) used to insert, modify, delete and retrieve data example:
INSERT INTO UPDATE or DELETE
Data Retrieval Language (DRL) used to query or retrieve data from a database example:
SELECT
Data Control Language (DCL) used for data access control
Transaction Control Language used for managing database transactions
Keywords These have a very specific meaning in the language. The statement must have at least one.
These often define the operation that is performed
Identifiers These refer to the names of the tables and columns that are called or manipulated
Null Value is a marker for data that has not been entered or is missing, unknown, or inapplicable
Not Null Constraint is only a column constraint and not a table constraint; if you don't specify a ,
the column will accept null values by default
Unique Constraint forces each value of a column or table to be unique
Check Constraint allows for limiting a particular column based on a particular value rules These
include:
minimum or maximum value
specified value
range of values
1/9
, ALTER table provides the ability to:
-add/drop a column
-alter a column's data type
-rename a column
-rename a table
-add, alter or drop a column's default value or null ability constraint
-add, alter or drop column or table constraints such as primary key, foreign key,
unique and check constraint
Select Statement is the basic building block of any data query request. It is command that pulls
specific data from a particular table within the database highlighted
Limit Statement it limits the number of rows that are shown
Order By is used to sort by data in a particular column or columns
Select Distinct eliminates duplicate values
Where can be used in combination with boolean comparators for columns that are numeric
or integers
Like allows to find similar text, but is case sensitive
% wildcard placeholder for text used with LIKE or ILIKE statements
ILIKE same as LIKE statement but not sensitive to capitalization
IN equivalent to multiple OR statements
Between can be used to find a range instead of using > and <
NOT can negate IN, Between, LIKE or conditional statement
derived column is the result of a calculation and is created with a SELECT --- clause expression tha
is something other than a simple reference to the column
t
COALESCE replaces NULL values with another value
2/9