MySQL database using the SQL SELECT statement to query data.
You can mysql> command prompt window to query data in a database, or to query the data via a PHP script.
grammar
The following is a general-purpose data query SELECT syntax in MySQL database:
SELECT column_name,column_name FROM table_name [WHERE Clause] [LIMIT N][ OFFSET M]
- You can query using one or more tables, use a comma between tables (,) division, and use the WHERE clause to set the search criteria.
- SELECT command reads one or a plurality of records.
- All field data you can use the asterisk (*) instead of the other fields, SELECT statement returns a table
- You can use the WHERE clause to include any conditions.
- You can use the LIMIT attribute to set the number of records returned.
- You can specify the data offset the query SELECT statement begins by OFFSET. Offset 0 by default.
Obtaining data from the command prompt
The following examples will we get the data to MySQL data table runoob_tbl through SQL SELECT command:
Examples
The following examples will return all records of the data table runoob_tbl:
Read the data sheet:
select * from runoob_tbl;
Output: