Site icon

Retrieve Information from a MySQL Table


We can retrieve information from a MySQL database table using the SELECT statement. We will use the table created in this example:

SELECT statement is used to retrieve information from the database table. The statement supports many clauses.

Select all rows

To retrieve all the rows in the table we use the following statement:

SELECT  * FROM <table_name>

For example, to retrieve all the rows in the table named supplier,

SELECT * FROM supplier;

SELECT * FROM testdb.supplier;

The * in the command will fetch all the columns in the table.


Select particular columns

We can specify the columns to show particular columns in the query output. For example, if we want only the supplier id column in the query result, we can use the following query.

SELECT supplier_id FROM supplier;

Select particular Rows

The WHERE clause if specified in the SELECT statement returns only the rows satisfied by the WHERE condition/(s).

MySQL Tutorials

MySQL Tutorials on this website:


Exit mobile version