I need a MySQL table that represents this data:
I wanted to name the time column time, timestamp, or date, but as you know, those are all reserved keywords. What is the best way to name a time column without purposely sounding cheesy to get around the naming limitations?
I understand the feeling that a column called EventDate in a table called Events (which, by all the DB conventions I've ever learned, should be called Event... ;)) is redundant, but consider:
You have an Event table with a Date column and a Booking table, whose records represent a customer's booking a seat at an event, also with a Date column (which, in this context, refers to the date that the seat was booked):
SELECT e.Date AS EventDate, b.Date AS BookingDate, [...]
FROM Event e
JOIN Booking b ON b.EventId = e.Id
Having to account for the ambiguous column names in every such query is a penalty which may (and does, in my opinion) outweigh the supposed redundancy of Event.EventDate.
Consider another argument which we can apply to the names of the ID columns in each table: calling the PK in Event EventId instead of merely Id lets us write this JOIN criterion:
JOIN Booking b ON b.EventId = e.EventId
Which we can see at a glance references the correct columns.
In summary, if we have to make the decision between calling the column Date or EventDate, the latter has many benefits:
Consider all the situations in which your table may be used when deciding on column names. In this case, I'll argue that the benefits of supplying context-specific information in the column name far outweigh the redundancy of repeating the table name.
I prefer verb in past tense and "Time", i.e. 'createdTime', 'publishedTime', in your case I can't find a verb, but 'matchTime' looks ok.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With