1. Basic grammarSELECT Query list FROM Table name WHERE filter expression; 2. Filter by conditional expression Conditional operators: #Filter all information of employees whose salary is greater than 12000 in the employees table SELECT * FROM employees WHERE salary>12000; 3. Filter by logical expression Logical operators: SELECT * FROM employees WHERE salary>12000 AND salary<16000; 4. Fuzzy query Keywords: ①like: Usually used with wildcards. Wildcards: #Query all information of employees whose second letter of name is aSELECT * FROM employees WHERE last_name LIKE '_a%'; ②between and: contains two critical values. Note that the order of the two critical values cannot be reversed. SELECT * FROM employees WHERE salary BETWEEN 10000 AND 16000; ③in: Determine whether the value of a field belongs to an item in the in list. Wildcards are not supported. #Query all information of employees with job numbers SA_MAN and PR_REPSELECT * FROM employees WHERE job_id IN('SA_MAN','PR_REP'); ④is null (is not null): is empty and not empty #Query all information of employees without bonus SELECT * FROM employees WHERE commission_pct IS NULL; 5. Safety is equal to Symbol: SELECT * FROM employees WHERE commission_pct <=> NULL; This is the end of this article about the necessary conditional query statements for MySQL database. For more relevant MySQL conditional query content, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Detailed explanation of the use of title tags and paragraph tags in XHTML
>>: How to make a website front end elegant and attractive to users
I divide the whole process into four steps: Downl...
Index merging is an intelligent algorithm provide...
Sort Tool The Linux sort command is used to sort ...
Table of contents 1. Introduction 2. On-demand at...
This article originated from the homework assignm...
Installation & Configuration The official web...
This article shares with you the specific method ...
Solution Add position:relative to the parent elem...
1. Qualitative changes brought by CSS variables T...
Library Operations Query 1.SHOW DATABASE; ----Que...
Asynchronous replication MySQL replication is asy...
As the first article of this study note, we will ...
In a project, you often need to use environment v...
Problem Description After installing Qt5.15.0, an...
Set the table's style="table-layout:fixed...