The SELECT statement is used to select data from a database.
SQL SELECT Syntax
SELECT field_names FROM table_name
Field name should be seperated with comma .
If you want the data from all the fields ,then just use “ * “
MySQL Table – users
+—-+——+
| id | name |
+—-+——+
| 1 | PHP |
| 2 | JS |
| 3 | HTML |
| 4 | JSP |
| 5 | ASP |
+—-+——+
Example
mysql> select * from users;
+—-+——+
| id | name |
+—-+——+
| 1 | PHP |
| 2 | PHP |
| 3 | PHP |
| 4 | PHP |
| 5 | PHP |
+—-+——+
mysql> select name from users;
+——+
| name |
+——+
| PHP |
| JS |
| HTML |
| JSP |
| ASP |
+——+