Home » RDBMS Server » Server Administration » Table Design Confution(URGENT)
Table Design Confution(URGENT) [message #52614] Thu, 01 August 2002 01:05 Go to next message
kothari Alpesh
Messages: 27
Registered: December 2001
Junior Member
Here with I giving structure of one table in different manner which is ideal structure in context of Primary key??

FIRST Table is

create table xyz
(
user_id number(5) not null,
terminal_id varchar2(15) not null,
rec_stts char(1) not null,
rec_updton date not null,
sch_cd number(3) primary key,
sch_desc varchar2(50) not null
)

SECOND Table is

create table xyz
(
sch_cd number(3) PRIMARY KEY,
user_id number(5) not null,
terminal_id varchar2(15) not null,
rec_stts char(1) not null,
rec_updton date not null,
sch_desc varchar2(50) not null
)

WHICH TABLE PERFORM WELL DOES IT MAKE ANY DIFFERENCE IF PRIMARY KEY DEFINE IN THE VERY FIRST COLUMN OF THE TABLE.
Re: Table Design Confution(URGENT) [message #52615 is a reply to message #52614] Thu, 01 August 2002 04:48 Go to previous messageGo to next message
Sanjay
Messages: 236
Registered: July 2000
Senior Member
2nd one.
Re: Table Design Confution(URGENT) [message #52617 is a reply to message #52614] Thu, 01 August 2002 05:11 Go to previous messageGo to next message
kothari Alpesh
Messages: 27
Registered: December 2001
Junior Member
Why Second one ?? Any Reason for that ???
Re: Table Design Confution(URGENT) [message #52619 is a reply to message #52614] Thu, 01 August 2002 07:51 Go to previous message
Radek
Messages: 33
Registered: April 2002
Member
By recommendation from Oracle Docs Primary key should be always first column in a table then not null columns should follow and the null columns. I would also recommend to reconsider data type length for your primary key. I would use generic NUMBER without length specification. Your way you save some storage space and probably will have to increase size of column very soon.
Regards,
Radek
Previous Topic: Index treated as primary key
Next Topic: How to create Unique Index on columns from two different tables?
Goto Forum:
  


Current Time: Thu Sep 19 14:57:02 CDT 2024