March 6, 2008 at 10:35 am
An application has a table which tracks the number of months a vehicle is expected to be in service under a given contract:
TABLE vehicleServiceContract
(
numMonths INT NOT NULL,
vehID varchar(12) NOT NULL, -- FK to vehicle table
contractNum varchar(20) NOT NULL -- FK to contract table
)
The system has been in place for a number of years. The client wants to add greater granularity to the table, storing the number of days a vehicle is expected to be in service.
The question is which is the better design idea:
1) Re-use the column
2) Add a new column
3) Other
How would the pros do it?
Thanks
ST
March 6, 2008 at 11:05 am
I'd add a new column.
March 6, 2008 at 11:47 am
I'd also consider making on a derived column of the other. meaning - days as a factor of months in service, or vice versa.
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
March 6, 2008 at 12:59 pm
Going back to the title of your post, 'What's in a column name'...
Since the column name is numMonths, DO NOT reuse the column to store the data as days. This will only lead to confusion for anyone else that ever has to query the table in the future.
If it was easy, everybody would be doing it!;)
March 7, 2008 at 8:03 am
This was a "round the water cooler" discussion. I appreciate your posts and agree.
Thanks
March 7, 2008 at 8:12 am
I agree with the above, I would add a new column for this request. But everytime I get a request like this, I am plagued with "foresight". Seeing as how they are asking me to track the number of days for this task, are they going to ask me to start tracking the individual sections of this task and how long each of these take? Should I build an new table to relate back to this one identifying that this task will take 3 days but the other 3 required tasks could push this up to eight?
So a questions about your work vs your sql skills, is it properly to look this far into a possible future and just add it in?
March 7, 2008 at 8:38 am
Probably the most important thing to do would be to ask exactly what they are trying to do, what information they need, and why they think adding this column will help.
You may find that what they are asking for is a completely inappropriate solution to the problem they are trying to solve. For example, maybe all they need is a simple way to convert months in service to number of days in service, and you could supply that in a view.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply