If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Compact Table Design

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-07-06, 21:57
Tommy1402 Tommy1402 is offline
Registered User
 
Join Date: Dec 2006
Posts: 2
Compact Table Design

I have 3 tables with period history field. the Period will be replaced with each end of the month in current year.
so: Period01 = January 31, 2006 and Period12 = December 31, 2006

Here are the fields of each of them:

Vendors (Vendor_ID, Purchase_Period01, Purchase_Period02 , ... , Purchase_Period12,
Payments_Period01, Payments_Period02 , ... , Payments_Period12
)

Items (Item_ID, UnitSold_Period01 , ... , UnitSold_Period12 ,
Sales_Period01 , ... , Sales_Period12 ,
UnitReceived_Period01 , ... , UnitReceived_Period12 ,
Cost_Period01 , ... , Cost_Period12 ,
UnitDamaged_Period01 , ... , UnitDamaged_Period12 ,
Loss_Period01, ... , Loss_Period12
)

Accounts (CoA_ID, Debits_Period01, ... , Debits_Period12 ,
Credits_Period01, ... , Credits_Period12 ,
Activity_Period01, ... , Activity_Period12 ,
Balance_Period01, ... , Balance_Period12
)


My Question is: Do all Tables above is in Normal Form?
If not, can you help me make those Tables in Normal Form?

I would like to compact those Tables' Field design so that those tables consist of as little as possible of Period Fields..?

Thanks for the help..
Reply With Quote
  #2 (permalink)  
Old 12-07-06, 22:55
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
here is a start --
Code:
create table Periods
( period_no  tinyint not null primary key 
, period_enddate  date not null
);   

create table Vendors
( vendor_id integer not null primary key 
, vendor_name varchar(37) not null
);  

create table VendorPurchases
( vendor_id integer not null  
, period_no tinyint not null
, primary key ( vendor_id, period_no )
, purchase_amt  decimal(11,2) not null
);
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 12-07-06, 23:04
Tommy1402 Tommy1402 is offline
Registered User
 
Join Date: Dec 2006
Posts: 2
Well, your solution is the same as everybody else. So, I guess It's the way to go.

Thanks for your help!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On