MySQL Tutorial – MySQL SELECT command

MySQL SELECT command is used to select record in a table. SELECT command is one of the most useful commands in SQL.

The syntax of SELECT command:

SELECT column_names FROM table_name;

Here is our database table: (employee_record)

[TABLE=3]

We will extract the first and lastname of employees. Issue the command:

SELECT f_name, l_name from employee_record;

Once you have encoded the command correctly, it will display the first and lastname of all the employee. Result would look like this:

+------------+---------+
| f_name     | l_name  |
+------------+---------+
| Piolo      | Pascual |
| Sam        | Milby   |
| John Lloyd | Cruz    |
| Rolan      | Algara  |
| Jericho    | Rosales |
| John       | Prats   |
+------------+---------+
6 rows in set (0.00 sec)

Note: To select all the columns in the table use asterisk (*).

Ex. SELECT * from employee_record;
, , ,

Post navigation

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.