Design Question - What's in a Column Name

  • 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

  • I'd add a new column.

  • 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?

  • 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!;)

  • This was a "round the water cooler" discussion. I appreciate your posts and agree.

    Thanks

  • 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?

  • 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