Commands: SQL, 'Structured Query Language', Is A Programming
Commands: SQL, 'Structured Query Language', Is A Programming
AND COUNT
SELECT column_name(s) SELECT COUNT(column_name)
FROM table_name FROM table_name;
WHERE column_1 = value_1
AND column_2 = value_2;
COUNT() is a function that takes the
AND is an operator that combines name of a column as an argument
two conditions. Both conditions and counts the number of rows
must be true for the row to be where the column is not NULL.
included in the result set.
CREATE TABLE
AS CREATE TABLE table_name (column_1
datatype, column_2 datatype, column_3
SELECT column_name AS 'Alias' datatype);
FROM table_name;
INSERT INTO table_name (column_1,
CREATE TABLE creates a new table column_2, column_3) VALUES (value_1,
in the database. It allows you to 'value_2', value_3);
specify the name of the table and
the name of each column in the INSERT statements are used to add
table. a new row to a table.
DELETE LIKE
DELETE FROM table_name WHERE SELECT column_name(s)
some_column = some_value; FROM table_name
WHERE column_name LIKE pattern;
SELECT column_name
FROM table_name ROUND() is a function that takes a
WHERE column_name = value_1
OR column_name = value_2;
column name and an integer as an
argument. It rounds the values in
OR is an operator that filters the the column to the number of
result set to only include rows decimal places specified by the
where either condition is true. integer.
ORDER BY SELECT
SELECT column_name SELECT column_name FROM table_name;
FROM table_name
ORDER BY column_name ASC|DESC;
SELECT statements are used to fetch
data from a database. Every query
ORDER BY is a clause that indicates
will begin with SELECT.
you want to sort the result set by a
particular column either
alphabetically or numerically.
SELECT DISTINCT
SELECT DISTINCT column_name FROM
OUTER JOIN table_name;
UPDATE
UPDATE table_name
SET some_column = some_value
WHERE some_column = some_value;
WHERE
SELECT column_name(s)
FROM table_name
WHERE column_name operator value;