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


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)

Updated on: 20-Jun-2020

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements