MySql database Select usage summary, mysqlselect
I. Conditional Filtering
1. Digital Filtering: SQL = "Select * from [sheet1 $] Where sales unit price> 100"
2. Character condition: SQL = "Select * from [sheet1 $] Where item name = 'fenders '"
3. Date condition: SQL = "Select * from [sheet1 $] Where item name = 'fenders '"
4. interval conditions: SQL = "Select * from [sheet1 $] Where date of shipment between # and #"
5. Multiple conditions: connect with and OR
'SQL = "Select * from [sheet1 $] Where date of shipment between #2005-1-4 # and #2005-1-10 # and Sales Unit Price> 100"
6. Fuzzy condition: % indicates any number of characters, and _ (underline) indicates a single placeholder.
'SQL = "Select * from [sheet1 $] Where item name like' % handrail % '"
7. Insert variable query:
'Sr = "fender" 'SQL = "Select * from [sheet1 $] Where item name ='" & sr &"'"
8. In a string group:
'SQL = "Select * from [sheet1 $] Where item name in ('body', 'bodybox ')"
9. Borrow function optimization:
'SQL = "Select * from [sheet1 $] Where left (item code, 3) = '028 '"
Ii. Specify Filtering
1. filter all fields: * indicates all fields
'sql = "Select * from ChuKu"
2. Filter specified fields: all fields to be displayed are listed before from. If you want to skip this field, use """"
'SQL = "Select", date of delivery, ", item code,", type, unit: from ChuKu"
3. Filtering records that are not repeated: names of the Distinct field are filtered out.
'SQL = "Select Distinct", item code from ChuKu"
4. Filter by percentage: Top N percent displays the first N percentage of records.
'sql = "Select top 30 Percent * from ChuKu"
'Use a function to further process and format the filtered fields.
'SQL = "Select ID, Format (warehouse date," "yyyy-mm-dd" ") from ChuKu"
5. Sorting: Desc descending and Asc ascending
'SQL = "Select * from ChuKu Order by warehouse date asc, sales unit price desc"' SQL = "Select Top 10 * from ChuKu Order by warehouse date asc, sales Unit Price desc "'filter the top 10 sales ()
3. group display
Group by can be used with functions for grouping and summation and grouping for maximum values.
'SQL = "Select", ", item code,", sum (outbound quantity) from ChuKu group by item code "'skipped """"
Display group records by conditions
'SQL = "Select", ", item code,", sum (outbound quantity) from ChuKu group by item code HAVING sum (outbound quantity)> = 3"
The above is a summary of the Select usage in the MySql database introduced by the small editor. I hope it will be helpful to you. If you have any questions, please leave a message and the small editor will reply to you in time. Thank you very much for your support for the help House website!