First of all, recommend a more useful database management software: Navicat Premium.
- The most important retrieval function in a database: SELECT statement
1. Retrieve a single column: Select Column name from table name;
2. Retrieve multiple columns: Select Column Name 1, column name 2,...from table name;
3. Retrieve all Columns: SELECT * from table name;
4. Retrieve different rows: Select DISTINCT column name from table name; */* Column with duplicate values, show only different values
5. Search Limit number of rows: Select Column name from table name limit quantity;/* Returns data with no more than a few rows
6. Retrieves the specified number of rows: Select Column name from table name limit (m,n);/* returns n rows beginning with line m
7. Use fully qualified table name: Select Table name. column name from database. Table name;
- Sort statement: ORDER BY statement
1, order BY column name 1, column name 2;
2. Order BY column name Dec; descending order
- Filter statement: where statement
1. WHERE clause operator:
Column name =; column name <>; column name <; column name >; Column name >=; column name <=; column name between and; column name is null;
2. Combine WHERE clause:
①and operator: Select column Name 1, column name 2, column name 3 from table name where column name 1= and column Name 2 =;
②or operator:
③in Operator: Specifies the condition range, where column name in (M,n,... );
④not operator: Specified range, not in (M,n,...);
3, the use of like+ wildcard filter: Wildcard characters used to match the value of a part of the special character, wildcard characters need to use single quotation marks.
①%: Any number of occurrences of any character;
②% character%: Identifies a value that matches any position that contains a character;
③x%y: Indicates that there is more data with the beginning of x ending with y;
④ underline: matches a single character;
4. Regular expressions
SQL Search Statements and filter statements