dbaspot
Tags Register FAQ Calendar Search Today's Posts Mark Forums Read

Re: separate columns or separate table? - databases

This is a discussion on Re: separate columns or separate table? - databases ; Frank, > acct_nbr DECIMAL(10) NOT NULL - Most of our account numbers are ten decimal digits, which is why I chose this. *What do you think is strange aboutit? There are no digits after comma, so I would rather see ...


Home > Database Forum > Other Databases > databases > Re: separate columns or separate table?

Reply

 

LinkBack Thread Tools Display Modes
  #1  
Old 09-03-2008, 06:30 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: separate columns or separate table?

Frank,

> acct_nbr DECIMAL(10) NOT NULL - Most of our account numbers are ten decimal digits, which is why I chose this. *What do you think is strange aboutit? <


There are no digits after comma, so I would rather see this as INTEGER
or CHAR(10) - depending on the requirements for your account number.

> Mandatory as in "can't create the table without it" or as in "highly recommended, but not actually enforced by the database"? *I'm guessing the later, because in DB2 I am definitely able to create a table that does not have a PK. <


The later. Even first normal form requires the table to have a primary
key. You could not reliably access a row without and you can not
prevent duplicated insertions in that table destroying your query
results then.

Regarding your multiple insertion question it came in my mind that DB2
has the ability to accept a single statement like:

INSERT INTO Calltrak.Call_Segments (call_id, service_code, acct_nbr)
VALUES (1, 'A', 1234567890),
(1, 'A', 1234567890),
(1, 'B', 1234567890),
(1, 'C', 1234567890),
(1, 'D', 1234567890);

Not sure if this helps, but might be worth a try.

Also service_code might become a bit short with CHAR(1) if the variety
of services grows. CHAR(3) for example would give more room for
growth.

brgds

Philipp Post
Reply With Quote
Reply

Thread Tools
Display Modes



All times are GMT -4. The time now is 12:07 PM.