I am creating an SQL database and got stack on the column of year which is in this format "2009/10". I would like to know which datatype i need to use?
Asked
Active
Viewed 1,529 times
-1
-
2Possible duplicate of [SQL DataType - How to store a year?](https://stackoverflow.com/questions/696506/sql-datatype-how-to-store-a-year) – BenM Jun 13 '19 at 08:25
-
A `string` datatype. Because there's not a simil type of datatype – Roy Bogado Jun 13 '19 at 08:25
-
1"year which is in this format "2009/10"...that looks like a year and a month, not a year. But yeah it's going to have to be text. There's no specific format which can store a date without the day part - although you could just use datetime and set all the days to 01. And that would mean it's a lot easier to do ordering, filtering etc by the dates. For display purposes you can always just extract the year and month parts alone and print those. – ADyson Jun 13 '19 at 08:35
1 Answers
0
You can Year as datatype, but you want to store value as 2009/10 so you have to give varchar as datatype

rohit
- 24
- 2