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

How to query a column by mysql

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "how to query a column of mysql". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

In mysql, you can use the select statement to query a column of data. The purpose of this statement is to query the data of the specified condition. The syntax is "select column name 1, column name 2. From table name".

The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.

How does mysql query a column

The MySQL database uses SQL SELECT statements to query data.

You can query the data in the database from the mysql > command prompt window, or query the data through the PHP script.

Grammar

The following is the common SELECT syntax for querying data in an MySQL database:

SELECT column_name,column_nameFROM table_ name[WHERE Clause] [LIMIT N] [OFFSET M]

You can use one or more tables in the query statement, split the tables with commas (,), and use the where statement to set the query conditions.

The SELECT command can read one or more records.

You can use an asterisk (*) instead of other fields, and the SELECT statement returns all the field data of the table

You can use the WHERE statement to include any condition.

You can use the LIMIT property to set the number of records returned.

You can specify the data offset to start the query with the SELECT statement through OFFSET. The offset is 0 by default.

The syntax of the query column is as follows:

Select column 1, column 2. From table name

Examples are as follows:

Query the data of the t_name and t_birth fields in the test table, and match the rows named names and names:

Mysql > select tours _ name _ name _ 2' +-+-+ | t_name | t_birth | +-+-+ | name2 | 2013-01-01 | +-+-+ 1 rows in set (0.00 sec) "how to query a column by mysql" ends here. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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