Home >Database >SQL >What is the function of where phrase in sql command?

What is the function of where phrase in sql command?

青灯夜游
青灯夜游Original
2020-08-31 17:10:2110446browse

The function of the where phrase in the sql command is to specify the selection criteria and filter records; if you need to conditionally select data from the table, you can add the WHERE clause to the SELECT statement.

What is the function of where phrase in sql command?

The WHERE clause is used to filter records. The WHERE clause is used to extract records that meet specified conditions.

To conditionally select data from a table, add a WHERE clause to the SELECT statement.

SQL WHERE syntax

SELECT column_name,column_name
FROM table_name
WHERE column_name operator value;

The following operators can be used in the WHERE clause:

##Note: In some versions of SQL, the operator can be written as !=.
Operator Description
= equals
is not equal to
> is greater than
is less than
>= greater than or equal to
less than or equal to
BETWEEN Search for a certain pattern within a certain range
LIKE

Use WHERE clause

If you only want to select people living in the city "Beijing", we need to add a WHERE clause to the SELECT statement:

SELECT * FROM Persons WHERE City='Beijing'

"Persons" table

Result:What is the function of where phrase in sql command?

For more related knowledge, please visit:What is the function of where phrase in sql command? PHP Chinese website

!

The above is the detailed content of What is the function of where phrase in sql command?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn