Basics Flashcards
Update statement
UPDATE
SET =, =
WHERE
insert statement
INSERT INTO table_name (column1, column2, column3, …)
VALUES (value1, value2, value3, …);
Declare variable
DECLARE @ =
varchar(n)
Variable width character string
nvarchar(n)
Variable width Unicode string
Bit
Integer that can be 0, 1, or NULL
tinyint
Allows whole numbers from 0 to 255
Smallint
Allows whole numbers between -32,768 and 32,767
Int
Allows whole numbers between -2,147,483,648 and 2,147,483,647
bigint
Allows whole numbers between -9,223,372,036,854,775,808 and 9,223,372,036,854,775,807 8 bytes
decimal(p,s)
COALESCE()
returns the first non-null value in a list
COALESCE(val1, val2, …., val_n)
CAST()
Converts a value of any type into a specific datatype
CAST(value AS DataType)
ISNULL()
Checks to see if the first value is null, if so it is the second argument gets returned
ISNULL(expression, value)
ISNUMERIC()
Returns 1 if the value is a number, otherwise 0
CONCAT()
Adds two or strings together