1 basic SELECT statement
Syntax: SELECT query list from table name;
Features: list of queries can be: table field, a constant value, Expression Functions
• SELECT identifies which columns are selected.
• FROM identifies the table from which to select.
Note • SQL language is not case sensitive.
• SQL can be written in one or more rows
• Keywords can not be abbreviated nor branch
• Each clause generally branches write.
• Use indentation to improve readability statement.
Column aliases
Column aliases: • Rename a column.
• easy to calculate.
• keeping up with the column name, you can also add the keyword 'AS' between the column name and alias, use double quotes to contain spaces or special characters in the alias and is case sensitive.
• string can be a string of characters in the SELECT list, numbers, dates.
• Date and character can only appear in single quotation marks.
• Whenever returns a row, the string is output once.
-filter
# Deduplication DISTINCT
# Condition query
select
Query List
from
Table Name
where
Filters;
classification:
1. conditional expressions screening
Conditional operator:> <= => = <=!
2. Press the logical expression
Role: Connection conditional expressions
&& || !
and or not
3. Fuzzy query
like
between and
in
is null
Sort query
grammar:
select query list
from table name
Filters [where]
order by sort field or expression
Features: asc: Ascending default
desc: descending
Common functions:
classification:
1. The one-way function:
length:
concat:
instr:
trim:
upper;
lower:
replace:
2. The group function
3. Mathematical Functions
4. The date function