Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Suitable Table Design ?

 
   Database Help (Home) -> Programming RSS
Next:  Null size  
Author Message
David Portas

External


Since: Nov 11, 2003
Posts: 854



(Msg. 1) Posted: Mon Feb 07, 2005 3:09 am
Post subject: Re: Suitable Table Design ? [Login to view extended thread Info.]
Archived from groups: microsoft>public>sqlserver>programming (more info?)

Performance is something that you need to test out in your own
evironment and with your actual data. A DATETIME uses 8 bytes rather
than 4 bytes for an INTEGER but I don't see why it should impact
performance significantly in your case. You might alternatively
consider using SMALLDATETIME, which is the same size as an INTEGER.

As for AmendId being a "sequence number", just what value is that
information? A DATETIME defines the sequence accurately and the
date/time of the change is much more useful data to keep. If the
ordinal sequence *number* is important to you then you can derive that
in a query or just put a row count next to the detail history when you
display it client-side.

--
David Portas
SQL Server MVP
--

 >> Stay informed about: Suitable Table Design ? 
Back to top
Login to vote
gopinathr

External


Since: Jan 10, 2005
Posts: 2



(Msg. 2) Posted: Mon Feb 07, 2005 5:40 am
Post subject: Re: Suitable Table Design ? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hello David,

Would (contract_num,details_changed_date) key be efficient in Queries or
(contract_num,AmendId) key be efficient
in Queries - Note that AmendId is a sequence number for each of the
amendments.

Gopi


"David Portas" wrote in message

 > The problem is that both designs are denormalized. You have contracts and
 > their details in the same table. Once you fix this a DATETIME should be
 > adequate to sequence the history of changes:
 >
 > CREATE TABLE contracts (contract_num INTEGER NOT NULL PRIMARY KEY, custid
 > INTEGER NOT NULL /* REFERENCES Customers (custid)? I'm assuming the custid
 > won't change */)
 >
 > CREATE TABLE contract_details (contract_num INTEGER NOT NULL REFERENCES
 > contracts (contract_num), details_changed_date DATETIME NOT NULL DEFAULT
 > CURRENT_TIMESTAMP, concrtdate DATETIME NOT NULL, brokerid INTEGER NOT NULL
 > /* REFERENCES Brokers (brokerid)? */, context VARCHAR(8000) NOT NULL,
 > conexpdate DATETIME NOT NULL, PRIMARY KEY
 > (contract_num,details_changed_date))
 >
 > --
 > David Portas
 > SQL Server MVP
 > --
 >
 >

 >> Stay informed about: Suitable Table Design ? 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
table design help - hey all, salary table ------------- salary date, Salary employment history table ----------------------------- job title, employment date let's say i want to pick a record in the history table and find out what salary they were making at the time....

Basic table design - Hi I Hope this is the right place to ask a simple table design question. How would I implement an order consisting of a number of order lines in a database. Here is my best shot. Order table OrderID (PK) Date, Soldby etc. OrderLines tabel OrderID...

need help with table design - opinions please - i have a table called ORDERQUEUE laid out like this create table [ORDERQUEUE] (oq_id int identity primary key, customer_id int not null, grouping_id int null, queue_date datetime not null default getdate().... other columns here) clustered index is..

Table Design Question - I'm trying to figure out the best way to design a couple of tables given the following scenario. Here's how I currently have it configured.. Table 1 called Packages is defined as: Package Id smallint Groups varbinary(256) Table 2 is called....

Table design - really stuck! - I am in the process of figuring out the schema for this database. I have most of the tables already figured out and set up in an Excel file so it is easier for me to see how they will be set up. I don't have code for this yet, but I came across an..
   Database Help (Home) -> Programming All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]