Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need help with a table / SQL design issue.
Message
From
25/05/2001 15:37:41
 
 
To
25/05/2001 14:57:45
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00511672
Message ID:
00511688
Views:
19
>Hello People,
> I have a table set up with the following fields: date(D),fund_id(C,10),shareclass(C,10),performance(N,10,3). For every unique fund_id there are anywhere from 1 to 25 share classes with performance history over a range of dates. I want to set up a way to update the performance values for a particular fund in a tabular format. For example, if FundA has 4 share classes and is chosen it would look like:
>
>Date Class1 Class2 Class3 Class4
>01/01/01 2.2 2.0 2.3 1.9
>01/02/01 -1.5 -1.3 -1.2 -1.7
>.
>.
>.
>05/25/01 5.3 4.9 5.0 5.1
>
>Is there a way to do this with a view created from a self-join? Should I set the table up differently. There are thousands of funds, so the file would get awfully big if I had a field for each possible share class. I am new to SQL so I apologize for my ignorance if the answer to my question is obvious or if I haven't explained my problem succinctly.
>
>Thanks in advance!
>
>- Tony

I would think you'd want to split the table into two: a fund table and a class table, like this:
create table FUND (date(D),fund_id(C,10))

create table FUNDSHARE (fund_id(c,10), shareclass(C,10),performance(N,10,3))
(no guarantees the syntax is correct)

The FUNDSHARE will be a child of the FUND table, linked via the common FUND_ID field. Yes, the FUNDSHARE table will get big but this is the best way to do this, since you don't know how many shares could belong to a fund. Yes, you could "best guess" the maximumn and set up that many columns in the fund table, but as soon as the share count exceeds your best guess - and it will - you have a potentially serious maintenance issue.
Dan LeClair
www.cyberwombat.com
SET RANT ON - The Wombat Blog

Life isn’t a morality contest and purity makes a poor shield. - J. Peter Mulhern
Disclaimer: The comments made here are only my OPINIONS on various aspects of VFP, SQL Server, VS.NET, systems development, or life in general, and my OPINIONS should not be construed to be the authoritative word on any subject. No warranties or degrees of veracity are expressed or implied. Void where prohibited. Side effects may included dizziness, spontaneous combustion, or unexplainable cravings for dark beer. Wash with like colors only, serve immediately for best flavor.
Previous
Reply
Map
View

Click here to load this message in the networking platform