In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1. Use the where clause
2.where clause operator
2.1 check a single value
2.2 mismatch check
2.3 range value check
2.4 Null check
Use the where clause
Database tables generally contain a large amount of data, and there is little need to retrieve all the rows in the table. A subset of table data is usually extracted according to the needs of a specific operation or report.
For example: find rows whose age is equal to 22 years old
MariaDB [test] > select age
-> from user
-> where age=22
+-+
| | age |
+-+
| | 22 |
+-+
1 row in set (0.00 sec)
Tip: when using both the order by and where clauses, order by should be placed after where.
Where clause operator
Equal to, not equal to, less than, less than or equal to, greater than, greater than or equal to, using between between two specified values
2.1 check a single value
MariaDB [test] > select id,age,province
-> from user
-> where province = 'Beijing'
+-- +
| | id | age | province | |
+-- +
| | 1 | 22 | Beijing |
| | 4 | 14 | Beijing |
| | 7 | 45 | Beijing |
| | 11 | 29 | Beijing |
| | 13 | 24 | Beijing |
+-- +
5 rows in set (0.01 sec)
2.2 mismatch check
MariaDB [test] > select id, age, province
-> from user
-> where age 22
+-- +
| | id | age | province | |
+-- +
| | 2 | 25 | Guangdong |
| | 3 | 56 | Tianjin |
| | 4 | 14 | Beijing |
| | 5 | 36 | Guangdong |
| | 6 | 68 | Hunan |
| | 7 | 45 | Beijing |
| | 8 | 17 | Hebei |
| | 9 | 33 | Tianjin |
| | 10 | 27 | Hunan |
| | 11 | 29 | Beijing |
| | 12 | 70 | Guangdong |
| | 13 | 24 | Beijing |
+-- +
12 rows in set (0.00 sec)
2.3 range value check
MariaDB [test] > select id,age,province
-> from user
-> where age between 25 and 33
+-- +
| | id | age | province | |
+-- +
| | 2 | 25 | Guangdong |
| | 9 | 33 | Tianjin |
| | 10 | 27 | Hunan |
| | 11 | 29 | Beijing |
+-- +
4 rows in set (0.00 sec)
2.4 Null check
Tip: the null value NULL (no value) is different from 0, empty string, or space.
MariaDB [test] > select id,age,province
-> from user
-> where age IS NULL
Empty set (0.00 sec)
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.