The SQL SELECT statement is used to select the records from database tables.
The basic syntax of the select clause is –
To select all columns from the table, the character is used.
Implementation of the Select Query :
Let us consider the following table ‘ Data ‘ with three columns ‘ FirstName ‘, ‘ LastName ‘ and ‘ Age ‘.
To select all the data stored in the ‘ Data ‘ table, we will use the code mentioned below.
SELECT Query using Procedural Method :
- The “res” variable stores the data that is returned by the function mysql_query().
- Everytime mysqli_fetch_array() is invoked, it returns the next row from the res() set.
- The while loop is used to loop through all the rows of the table “data”.
SELECT Query using Object Oriented Method :
SELECT Query using PDO Method :
- PHP | MySQL UPDATE Query
- PHP | MySQL Delete Query
- SQL | SELECT Query
- MySQL | Common MySQL Queries
- IFNULL in MySQL
- PHP | MySQL WHERE Clause
- MySQL | MD5 Function
- MySQL | BIN() Function
- How to get ID of the last updated row in MySQL?
- MongoDB vs MySQL
- DATE() in MySQL
- MySQL | IF( ) Function
- MySQL | COALESCE( ) Function
- MySQL | RENAME USER
- MySQL | PASSWORD Function
- MySQL | COMPRESS( ) Function
- MySQL | CAST( ) Function
- MySQL | SESSION_USER( ) Function
- MySQL | CONV( ) Function
- MySQL | USER( ) Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.