Home > Back-end >  Ask a about birthday storage problem
Ask a about birthday storage problem

Time:10-10

For example, I'm going to record students birthday
For example is on August 5,
So I database if it is a datetime, so he stored the years,
If it is varchar (50), so I like is not very good at query processing,

Because I want to query, were the effect of this month from 1 to 30, how many people's birthday party,

This birthday, how should I handle?

CodePudding user response:

SQL syntax has taken in, for example:

Select * from test where the MONTH (birthday)=10

So, you can directly use the date type of data,

CodePudding user response:

1, there is nothing wrong with a DateTime type storage, using database date function, and day to separate,
2, use the varchar can also, month, and day each with two coding, string comparison or turn numeric types can also,
  • Related