MySQL Select
The MySQL SELECT statement is used to fetch data from table.
Syntax of SELECT statement
mysql->SELECT [Fields] FROM Tablename [WHERE CLAUSE] [LIMIT];
The fields can be either single field name or multiple fields name.
The given query select first_name and last_name from 'students' table.
mysql->SELECT first_name, last_name FROM students;

Select All
We can use '*' special character to select all fields values.
mysql->SELECT * FROM students;

WHERE Clause
We can also fetch data on condition basis by using WHERE clause. The given query fetch only student data whose id is '2'.
mysql->SELECT * FROM students WHERE id = '2';

We can also apply multiple conditions in SELECT statement, like -
mysql->SELECT * FROM students WHERE class = '4A' OR age = '10';

LIMIT
To fetch limited result rows use LIMIT keyword. The given query returns only two rows data.
mysql->SELECT * FROM students LIMIT 2;

ORDER BY
We can sort multiple columns in ascending or descending order.
mysql->SELECT * FROM students ORDER BY first_name ASC;
