Avatar of MohitPandit
MohitPanditFlag for India

asked on 

SQL Server 2008: Design table structures

Hello,

I would like to design database structure on which could you please give your greater thoughts as per below requirements?

I have a report which will be scheduled nightly and when end user will come up in the morning then program needs to fetch data only from calculated stored tables; there will not be any calculation from other transaction tables.

For e.g., I've a two dropdown list / combo box i.e. Department and Salary with multi select option. (Note: Department and Salary from other master tables which are also having internal ID in database like HR - 1, Sales -2 and similar 0 to 10000 - 101 on so on.

Now, user can select one/multiple item(s) from Department and Salary as well.

Department      Salary
HR                      0 to 10000
Sales              10000 to 15000
Account              15000 to 20000
Market              20000 Above

Questions:
1. What should be the best structure design like we have in OLAP?
2. We need to store calculated result nightly based on all permutation & combination, do you have any thoughts?
3. How we can generate a key to fetch calculated data?


Best Regards,
Mohit Pandit
Microsoft SQL Server 2008Microsoft SQL Server 2005Microsoft SQL Server

Avatar of undefined
Last Comment
MohitPandit
Avatar of arnold
arnold
Flag of United States of America image

Are you talking about installing sql server reporting services where you can design reports to get the data you want from the data stored in the database.
Well for that we will be required complete information that how your source tables holding data and what you required to show in report...

But one suggestion can be ...
You are running your process over night so do every calculation with each permutation & combination and store them in a flat table...
In morning Report will required only to fetch and show that data...

And for the key you can define as per your permutation ...
Avatar of MohitPandit
MohitPandit
Flag of India image

ASKER

Hi Saurv,

Yes, it will be nightly process and in the morning on fetch. You caught correctly.

You may take same example aforesaid for department and salary. Kindly let me know in case you need more information.

Best Regards,
Mohit Pandit
Avatar of MohitPandit
MohitPandit
Flag of India image

ASKER

Hi,

I've done it myself. I stored the combination in separate table let's say 'LookUp' along with 'Internal_Id' and in another table I store a key with combination in another table.

For e.g. first, I've only three values in two dropdownlist as below:
Note: we will be having default value "Select All" so that means 4 values instead of 3 in dropdown.

Department      Salary
HR (1)      0 to 10000 (1)
Sales (2)      10001 to 20000 (2)
Market (3)      20001 Above (3)

So, second, below table of combinations (as lookup):
As you can see 9 combination because we will be having other value "Select All" and NULL values shows user select all
Internal_Id      Department      Salary
1      1      1
2      1      2
3      1      3
4      2      1
5      2      2
6      2      3
7      3      1
8      3      2
9      3      3
10      NULL      1
11      NULL      2
12      NULL      3
13      1      NULL
14      2      NULL
15      3      NULL
16      NULL      NULL


and third, the Internal_Id column will be used to store actual result values in other result table.
Like I aforesaid 2nd point, all combination key value from 1 to 16 and it will also be having combination like 1,2 (if end user selects department = 1 and salary = 1 and 2) then internal id will match for two rows and internal id will be 1 & 2. So, it will be store in comma separated with in result table.

Now, one challenge seems, the comma separated key combination of internal_id column.

Could you please look into it and give your great thoughts?

Best Regards,
Mohit Pandit
ASKER CERTIFIED SOLUTION
Avatar of Saurabh Bhadauria
Saurabh Bhadauria
Flag of India image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of MohitPandit
MohitPandit
Flag of India image

ASKER

thanks for this.
Microsoft SQL Server
Microsoft SQL Server

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

171K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo