Sample Header Ad - 728x90

Does it make sense to define a new "Data type"? Is there a way to do so?

0 votes
1 answer
74 views
I'm basically new to SQL, and I was making my own project when this question came to my mind. I'm making a database that has an entity where an attribute would be a "number" and a "year". In many programming languages one would create a new object or data type that takes both the number and the year. (say a tuple with INT, YEAR) I wanted to know if this makes sense in SQL or I should just go with an INT and YEAR attribute. To put more details into the project, I'm creating a DB for my mom who runs a business that goes with "campaings" (the INT value) directly associated with the "Year", so one would put the campaign 09 for year 2020, and so on. I wanted to create a new Data Type for the attribute so then I don't have multiple "campaign 09" with different years. I hope my question is clear, thanks! EDIT: Read the comments for the answer.
Asked by Francisco Laferrière (103 rep)
Apr 25, 2021, 04:30 PM
Last activity: Apr 26, 2021, 04:10 PM