Introduction to SQL (Part I)
Created by Savage Killer
query
is a specific request for data manipulation issued by the
end-user or the application to the DBMS
| Term | Definition |
|---|---|
query | is a specific request for data manipulation issued by the
end-user or the application to the DBMS |
Structured Query Language | SQL stands for |
Exact numeric | bigint, bit, decimal, int, money,
numeric |
Approximate numeric | float, real |
Date and time | date, datetime, time |
Character strings | char, text, varchar |
Unicode character
strings | nchar, ntext, nvarchar |
Binary strings | binary, image, varbinary |
Other data types | cursor, sql_variant, table,
uniqueidentifier, xml
|
Arithmetic | +, -, *, /, % |
Comparison | =, >, <, >=, <=, <> |
Compound | +=, -=, *=, /=, %= |
Logical | AND, OR, NOT, LIKE, IN, BETWEEN,
EXISTS, ANY, ALL |
CREATE DATABASE | creates a new database |
DROP DATABASE | deletes an existing database |
CREATE TABLE | creates a new table in a database |
DROP TABLE | deletes an existing table in a database |
ALTER TABLE | Adds, deletes, or modifies columns in an existing
table
|
NOT NULL on CREATE TABLE | ensures that a column cannot
have a NULL value upon creating a table |
NOT NULL on ALTER TABLE | ensures that a column in an
existing table cannot have a NULL value |
UNIQUE on CREATE TABLE | ensures that all values in a column
are different upon creating a table |
UNIQUE on ALTER TABLE | creates a UNIQUE constraint on a
column of an existing table |
PRIMARY KEY on CREATE TABLE | uniquely identifies each row
in a table |
PRIMARY KEY on ALTER TABLE | creates a PRIMARY KEY
constraint on a column of an existing table |
FOREIGN KEY on CREATE TABLE | uniquely identifies a row in
another table
|
FOREIGN KEY on ALTER TABLE | creates a FOREIGN KEY
constraint on a column of an existing table |
CHECK on CREATE TABLE | ensures that all values in a column
satisfy a specific condition upon creating a table |
CHECK on ALTER TABLE | ensures that all values in a column of
an existing table satisfy a specific condition |
DEFAULT on CREATE TABLE | sets a default value for a column
when there is no value specified |
DEFAULT on ALTER TABLE | sets a default value for a column of
an existing table when there is no value specified |