How to apply EXTRACT() function with WHERE Clause on the dates stored in MySQL table?

With the help of following MySQL query, we can apply EXTRACT() function with WHERE clause on the dates stored in a table.

mysql> Select StudentName,EXTRACT(Year from dateofreg)AS YEAR from testing WHERE StudentName = 'Gaurav';
| StudentName | YEAR |
| Gaurav      | 2017 |
1 row in set (0.00 sec)
Published on 19-Feb-2018 14:28:49