How can we fetch a particular row as output from a MySQL table?

MySQLMySQLi Database

For fetching a particular row as output, we need to use WHERE clause in the SELECT statement. It is because MySQL returns the row based on the condition parameter given by us after WHERE clause.

Example

Suppose we want to fetch a row which contains the name ‘Aarav’ from student table then it can be done with the help of the following query −

mysql> Select * from Student WHERE Name = 'Aarav';
+------+-------+---------+---------+
| Id   | Name  | Address | Subject |
+------+-------+---------+---------+
| 2    | Aarav | Mumbai  | History |
+------+-------+---------+---------+
1 row in set (0.00 sec)
raja
Published on 19-Feb-2018 10:50:23
Advertisements