In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This "mysql how to query specified conditions" article, the article example code is introduced in great detail, with a certain reference value, interested friends must refer to, for "mysql how to query specified conditions", Xiaobian sorted out the following knowledge points, please follow the pace of the editor step by step slowly understand, then let us enter the topic.
In mysql, you can use the select statement with the WHERE clause to query the specified condition, the SELECT statement is used to read the data, the WHERE clause is used to set the conditional read data, and the syntax is "select field list from table name where conditional statement".
The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.
How to query a specified condition by mysql
Use SQL SELECT statements to read data from the MySQL table.
To conditionally select data from a table, you can add a WHERE clause to the SELECT statement.
I. definition
Use the where clause to filter the data in the table and output the filter results.
II. Grammar
Select field list from table name where statement
III. Classification
1. Filter by relational operator
Equal to =
Greater than >
Greater than or equal to > =
Less than 10 and name=' Zhang San'# query data with age greater than 10 and name equal to "Zhang San". Select * from student where not name=' Zhang San'# # query data whose name is not equal to "Zhang San".
3. Scope query
In
Between large value and decimal value
Examples are as follows
Select * from student where age in (10, 10, 11) # # query data with age equal to 10 or 11. Select * from student where age=10 or age=11 # # is equivalent to the above statement. Select * from student where age between 10 and 24 # # queries data with age between 10 and 24, including boundary values.
4. Empty judgment
Select * from student where address is null # # query data whose address is null select * from student where address is not null # # query data whose address is not null
5. Fuzzy query
Like
% represents any number of characters (including 0)
_ represents any character
Escape: cancel wildcard properties for% or _ characters
Examples are as follows
Select * from student where name like 'Wang%' # query the data surnamed Zhang in name. Select * from student where name like 'Zhang _ # # query the data of two words surnamed Zhang in name. Select * from student where name like'% A%% 'escape' A' # query the data containing "%" in name. These are all the contents of the article "how to query specified conditions in mysql". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.