October 21, 2013 at 12:03 pm
Hi,
This is kind of my first DDL table, so just want to check with all gurus, it has some cust definition and totals like below:
Cust_Category | Cust_SubCat | Network | Product | Count |
Access will be by all first 4 columns to get count for last period of time for specific product, should I define PK like composite for all 4?:
I don't think we need any indexes it's monthly cycle, for single month we expect close to 500 entries
Cust_Category + Cust_SubCat + Network + Product
Thanks all
Mario
October 21, 2013 at 12:21 pm
mario17 (10/21/2013)
Hi,This is kind of my first DDL table, so just want to check with all gurus, it has some cust definition and totals like below:
Cust_Category | Cust_SubCat | Network | Product | Count |
Access will be by all first 4 columns to get count for last period of time for specific product, should I define PK like composite for all 4?:
I don't think we need any indexes it's monthly cycle, for single month we expect close to 500 entries
Cust_Category + Cust_SubCat + Network + Product
Thanks all
Mario
You don't define the primary key based on how you will retrieve the data. You define a primary key based on how you uniquely identify a row. Having no details to go on it appears that by the names this may or may not be a good candidate key for the table.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
October 21, 2013 at 1:12 pm
+1 to what Sean wrote. You might index on these four columns if that is how you access things, but that doesn't necessarily relate to the PK.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy