SELECT Statement Basics
SELECT < column name >,.....
From < table name >;
Query all columns: SELECT * from < table name >;
Use the AS keyword to set the alias for the column, and set the Chinese alias to enclose it in double quotation marks (").
Use distinct in a SELECT statement to delete duplicate rows.
Where: To follow the FROM clause, first use the WHERE clause to query for a record that matches the specified criteria, and then select the column specified by the SELECT statement.
A comment is a section of an SQL statement that identifies a description or note, divided into 1 lines of comments (written after "-") and multiline comments (written between "/*" and "/*", which can span multiple lines).
Arithmetic operations conform to comparison operators
A SELECT clause can use a constant or an expression.
Be sure to note the position of the inequality and equal signs when using comparison operators. (You can use! = and <> in MySQL)
Data of type string is sorted in dictionary order in principle. Cannot be confused with the size order of the numbers.
When you want to select a null record, you need to use the IS null operator in the conditional expression. When you want to select records that are NOT NULL, you need to use the is not NULL operator in the conditional expression.
logical operators
The NOT operator is used to negate a condition, but it cannot be abused.
When multiple query conditions are combined, you need to use the AND operator or the OR operator.
The AND operator has a higher precedence than the OR operator. Parentheses are used when you want to prioritize or operations.
SQL--chapter02 Query Basics