programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Tim Cooke
• Campbell Ritchie
• Jeanne Boyarsky
• Ron McLeod
• Liutauras Vilda
Sheriffs:
• Rob Spoor
• Junilu Lacar
• paul wheaton
Saloon Keepers:
• Stephan van Hulst
• Tim Moores
• Tim Holloway
• Carey Brown
• Scott Selikoff
Bartenders:
• Piet Souris
• Jj Roberts
• fred rosenberger

# Decimal problem

Ranch Hand
Posts: 44
• Number of slices to send:
Optional 'thank-you' note:
I was taking an online class and I saw this,
CREATE TABLE STAFF(STAFFNUM DECIMAL(6,0));

Could we also put this as STAFFNUM INT ? Why are users allowed to specify 0 decimal places?

author & internet detective
Posts: 41124
848
• Number of slices to send:
Optional 'thank-you' note:
Maybe the table creator was trying to specify that the id number cannot be more than six digits?

I suspect this could be a char(6) or varchar(6) column rather than numeric in the first place. Unless it makes sense to do arithmetic or numerical comparisons with ids, they aren't really numbers. They are identifiers that happen to consist of digits.

Ranch Hand
Posts: 338
• Number of slices to send:
Optional 'thank-you' note:

Originally posted by Jeanne Boyarsky:
Maybe the table creator was trying to specify that the id number cannot be more than six digits?

I suspect this could be a char(6) or varchar(6) column rather than numeric in the first place. Unless it makes sense to do arithmetic or numerical comparisons with ids, they aren't really numbers. They are identifiers that happen to consist of digits.

STAFFNUM is likely similar to my employee number... which happens to be 6 digits as well.

From a data modeling standpoint... it isn't really a number and should be stored as character data.
[ October 19, 2007: Message edited by: Paul Campbell ]

 With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.