Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

database design - is `date` a valid mysql column name?

I was wondering if date is actually a valid mysql column name?

According to the manual

MySQL permits some keywords to be used as unquoted identifiers because many people previously used them. Examples are those in the following list:

  • ACTION
  • BIT
  • DATE
  • ENUM
  • NO
  • TEXT
  • TIME
  • TIMESTAMP

So, from that I gather you are allowed to use date as a column name, but it doesn't say that it is not recommended.

So, are there any implications to using date as a column name?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I was able to add a column named date to the database, no quotes required.

So, yes, it's possible.

But you don't need to. Choose another column name, e.g. "date_recorded". Not only is it better syntactically, but it's more descriptive.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...