Some notes here were taken while studying the first lessons of “SQL Fundamentals” from
Others were taken by demand.
NOTE: I only tested this on MySQL.
SELECT
column_list
FROM
table_name
WHERE
string_column REGEXP pattern;
example:
SELECT
productname
FROM
products
WHERE
productname REGEXP '^(A|B|C)'
ORDER BY productname;
Works like uniq
in shell scripts.
Counts the number of rows.
Counts the number of non-missing values in column_name
.
Counts the number of distinct values in column_name
.
Checks if the value of a
is between the values x
and y
(inclusive).
Checks if a
is equal one of the values in the list.
Allows using patterns for searching.
%
is a wildcard fro “anything”, and _
is a wildcard forr any character).
SELECT COUNT(*)
FROM UserAccounts
WHERE RAPoints < 1000;
SELECT COUNT(*)
FROM UserAccounts
WHERE LastLogin < ??????(timestamp)
SELECT COUNT(DISTINCT Author)
FROM Achievements;
???
SELECT COUNT(*)
FROM UserAccounts
WHERE
RAPoints < 1000
AND LastLogin < ??????(timestamp)
AND ?????;
SELECT User
FROM UserAccounts
WHERE
RAPoints < 1000
AND LastLogin < ??????(timestamp)
AND ?????;
???
NOTE: rescores won’t allow it to be accurate.