+1 vote
in Databases by (17.1k points)
In the MySQL table, the date is stored in YYYY-MM-DD format. I want to select only the year from the date instead of the complete date. How can I do it using SQL?

1 Answer

+2 votes
by (89.5k points)
selected by
 
Best answer

To select only year from date in SQL, you can use the YEAR() function in MySQL. 

Here is an example SQL:

SELECT YEAR(your_date_column) FROM your_table;

In the above SQL, replace your_table with your actual table name and your_date_column with the column containing the date data.

Related questions


...