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
where
]. Mysql method of querying a row of data in a table:
Basic of Select statement Syntax:
Select <列的集合> from <表名> where <条件> order by <排序字段和方式>Copy after loginIf you want to query all the data of a specified row in a table, the query statement can be written as:
select * from <表名> where <条件>Copy after loginWhy 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='name2'; +------+--------+----------------------------------+------------+ | t_id | t_name | t_password | t_birth | +------+--------+----------------------------------+------------+ | 2 | name2 | 12345678901234567890123456789012 | 2013-01-01 | +------+--------+----------------------------------+------------+ 1 rows in set (0.00 sec)Copy after loginMore 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!
Related labels:source:php.cnPrevious article:What is the subject of the database? Next article:How to configure mysql after installing itStatement of this WebsiteThe 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.cnLatest Articles by Author
2023-04-09 22:44:01 2021-05-21 15:21:45 2023-04-09 22:42:01 2023-03-09 12:50:01 2023-01-05 16:13:24 2023-01-05 16:13:23 2021-04-30 16:46:04 2023-01-05 16:13:23 2023-01-05 16:13:22 2021-04-30 16:27:19Latest IssuesHow to group and count in MySQL? I'm trying to write a query that extracts the total number of undeleted messages sent to f...From 2024-04-06 18:30:1701353MySQL gets data from multiple tables I have a eg_design table which contains the following columns: and eg_domains table which ...From 2024-04-06 18:42:4402479Related TopicsMore>