Common case template for SELECT operator for single table
SELECT column, another_column, …
FROM mytable
WHERE condition(s)
ORDER BY column ASC/DESC
LIMIT num_limit OFFSET num_offset;
SELECT - shows what the specific data we want to find. Available parameters: * (all columns) or [columns list]
FROM - explains to the DB server, what a table we want to process. Available parameter: table name
WHERE - explains to the DB server, what a rules we want to use when filter column(s) entity.
Here, we can use logical unary NOT, LIKE, IS or binary AND, OR operators. Also, math comparison operators are available: =, !=, < <=, >, >=. We can use expressions, like: BETWEEN 20 AND 50
ORDER BY - describe way to items display order (alphabetic by value grows or falls)
LIMIT - restrict display items count.
OFFSET - explains to the DB server, how many items we want to pass before display found rows.
We can use DISTINCT instruction after SELECT operator to trim duplicates inside output dataset.
Комментарии
Отправить комментарий