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

MySQL--4 query

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

# basic syntax of query

Select * from table name

The table name is written after the from keyword, indicating that the data comes from this table.

Write the name of the column in the table after select. If it is * *, it shows all the columns in the table in the result.

In the column names section after select, you can use as to list aliases that appear in the result set

If you want to query multiple columns, separate them with commas

Example:

Select id,name from students

Eliminate duplicate lines

Use distinct before the column after select to eliminate duplicate rows

Select distinct gender from students

# conditions

Use the where clause to filter the data in the table, and the row with the result of true appears in the result set

The syntax is as follows:

Select * from table name where condition

Comparison operator

Equal to =

Greater than >

Greater than or equal to > =

Less than <

Less than or equal to 3

Query for subjects whose number is less than 4

Select * from subjects where id3 and gender=0

Students whose query number is less than 4 or have not been deleted

Select * from students where id

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