June 14, 2012 at 10:06 pm
hi guys,
i have two tables one one with 1000 rows and another with 500 rows,
suppose Table1(Roles) contains admin,staff,developer,tester..etc.,
Table2 contains(Screens) contains Screen1, screen2,screen3...etc.,
how to map this two tables...
my friends suggested that map row ID's of both tables..in another table(say Table3) and use it..then Table3 contains more rows, i need to decrease this, is there any other way?
if yes please suggest me..
[font="Verdana"]SRIHARI(:~[/font]
June 14, 2012 at 11:22 pm
The details you have provided are not sufficient. What kind of a database is it? Are the tables going to be related in any way?
June 14, 2012 at 11:51 pm
I think your friend's suggestion is appropriate.
If you're worried about having 500000 rows in the role/screens table, try only storing the relation if the role is authorized to use the screen.
My thought question: Have you ever been told that your query runs too fast?
My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.
Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
Since random numbers are too important to be left to chance, let's generate some![/url]
Learn to understand recursive CTEs by example.[/url]
[url url=http://www.sqlservercentral.com/articles/St
June 15, 2012 at 12:36 am
Are the two tables related??....If yes then which are the fields which relate Table1 to Table2. You need to provide some more info like this for us to understand your Design.
June 15, 2012 at 1:25 am
vinu512 (6/15/2012)
Are the two tables related??....If yes then which are the fields which relate Table1 to Table2. You need to provide some more info like this for us to understand your Design.
They may not be directly related. You may need a third table to handle the relation between the first two tables. Not enough information to really know.
June 15, 2012 at 3:08 am
dwain.c (6/14/2012)
I think your friend's suggestion is appropriate.If you're worried about having 500000 rows in the role/screens table, try only storing the relation if the role is authorized to use the screen.
+1.
I agree with Dwain. There needs to be a substantial relation between the Screens and the Roles according to which they could be mapped using a third table.
Or is it that all the screens would be related to all the Roles??....May be something like creating a table as a Cross Join between the two tables, Partitioning the data according top Roles and adding an Identity(Row_Number()) depending on the Partitions and this field would map the Roles and the Screens??
June 15, 2012 at 3:11 am
Lynn Pettis (6/15/2012)
vinu512 (6/15/2012)
Are the two tables related??....If yes then which are the fields which relate Table1 to Table2. You need to provide some more info like this for us to understand your Design.They may not be directly related. You may need a third table to handle the relation between the first two tables. Not enough information to really know.
Yes, you are right Lynn.
I was just asking the OP if there is really need for a third table or could there be other alternatives.
June 15, 2012 at 3:28 am
miriyalasrihari (6/14/2012)
..then Table3 contains more rows, i need to decrease this, is there any other way?if yes please suggest me..
Why do you need to decrease this?
I would say, don't worry about number of rows. Don't cut corners. Design correctly.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply