Get the App
SLTechnology News&Howtos  ›  Database  › 

What are the syntax keywords used to implement the selection operation in the sql query statement

Shulou Source: shulou.com Published: 2022-05-31 23:41:41 09月25日 Update

This article mainly introduces sql query statements used to achieve selection of syntax keywords is what, with a certain reference value, interested friends can refer to, I hope you read this article after a great harvest, the following let Xiaobian with everyone to understand.

In SQL select statements, the syntax keyword used to implement the selection operation is "WHERE." In SQL query statements, the WHERE clause is used to specify query conditions, and only tuples that meet the conditions will appear in the result set.

In SQL select statements, the syntax keyword used to implement the selection operation is "WHERE."

In sql, the WHERE clause is used to extract records that satisfy specified conditions. If you need to query data conditionally from a data table, you can use the WHERE keyword to specify the query criteria.

The WHERE clause restricts the return of data in the table. Data that meets the conditions after where will be selected, and statements that do not meet the where conditions will be filtered out.

The syntax for using the WHERE keyword is as follows:

WHERE query condition

Query criteria can be:

Query conditions with comparison and logical operators

Query criteria with BETWEEN AND keyword

Query criteria with IS NULL keyword

Query conditions with IN keyword

Query criteria with LIKE keyword

The following operators can be used in WHERE clauses:

Note: In some versions of SQL, the operator can be written as!=.

use the WHERE clause

1. Query statement with single condition

A single condition means that there is only one query condition after the WHERE keyword.

Example: Query the tb_students_info data table for the names of students younger than 22

mysql> SELECT name,age FROM tb_students_info -> WHERE age SELECT name,age,height FROM tb_students_info -> WHERE age>21 AND height>=175;+--------+------+--------+| name | age | height |+--------+------+--------+| Henry | 23 | 185 || Jim | 24 | 175 || Thomas | 22 | 178 |+--------+------+--------+3 rows in set (0.00 sec)

As you can see, all records in the query result have an age field greater than 21 and a height field greater than or equal to 175.

Thank you for reading this article carefully. I hope that Xiaobian's shared "What are the syntax keywords used to realize the selection operation in sql query statements?" This article is helpful to everyone. At the same time, I hope that everyone will support you a lot and pay attention to the industry information channel. More relevant knowledge is waiting for you to learn!

Tags: Queries conditions keys statements operations keywords keywords syntax clauses data selections articles results operators fields only multiple students datasheets examples Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Shulou Technology MySQL macOS Huawei