Home  >  Article  >  Database  >  How to query a row of data in a table with mysql

How to query a row of data in a table with mysql

coldplay.xixi
coldplay.xixiOriginal
2020-11-12 10:19:3011482browse

Mysql method of querying a row of data in a table: Use the select statement to query, and use the where condition to select by row. The syntax is [select * from ccc43248daffbac9770dee47fdaff697 where 0945b9ca1141d3b4a671e95b16b4843e].

How to query a row of data in a table with mysql

Mysql method of querying a row of data in a table:

Basic of Select statement Syntax:

Select <列的集合> from <表名> where <条件> order by <排序字段和方式>

If you want to query all the data of a specified row in a table, the query statement can be written as:

select * from <表名> where <条件>

Why is this statement? Let’s briefly analyze it. . So the data actually includes all rows and all columns, so:

1. First, select all columns

The "column set" should include all fields. You can use an asterisk (*) in an SQL statement to refer to all fields.

2. Then select the specified row

Use the where condition to select by row.

Let’s look at an example to query all records in the test table with a t_name value of name2:

mysql> select * from test where t_name=&#39;name2&#39;;
+------+--------+----------------------------------+------------+
| t_id | t_name | t_password                       | t_birth    |
+------+--------+----------------------------------+------------+
|    2 | name2  | 12345678901234567890123456789012 | 2013-01-01 |
+------+--------+----------------------------------+------------+
1 rows in set (0.00 sec)

More related free learning recommendations: mysql tutorial (video)

The above is the detailed content of How to query a row of data in a table with mysql. 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