Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction to MySQL database-- where clause, combined where clause

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The where clause of the select statement specifies that the search criteria filter the data displayed.

(1) use the where clause

In the select statement, the where clause is given after the from clause and returns data that meets the specified search criteria:

Select prod_name, prod_price from Products where prod_price = 3.49

# retrieve two columns from the Products table: prod_name, and prod_price, provided that only rows with a prod_ print value of 3.49 are displayed.

In addition to the equality condition judgment in the above example, the where clause also supports the following conditional operators:

For example, use the operator (or! =) to check for mismatches:

Select vend_id, prod_name from Products where vend_id 'DLL01'

# display vend_id, and prod_name from the Products table, but only if vend_id is not DLL01.

As another example, use the between operator to match values within a range. You need to specify the end value of the range:

Select prod_name, prod_price from Products where prod_price between 5.99 and 9.49

# display prod_name, prod_price from the Products table, but only if the price is between $5.99 and $9.49 (inclusive)

(2) combine where clauses

(1) SQL also allows you to combine multiple where clauses using the and or or operators, such as the and operator:

Select prod_id, prod_price, prod_name from Products where vend_id = 'DLL01' AND prod_price

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report