Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Faster Search on Column or Rows

Author  Topic 

neutcomp
Posting Yak Master

111 Posts

Posted - 2004-02-04 : 04:00:05
Hello Everyone!

Just a simple question does it mather if you have this OPTION 1:
userID key_01 key_02 key_03 key_04 key_05 key_06 ... key_45
1 3 30 11 3 1 2 76 10 ... 54
2 3 . 11 . 14 . . 12 ... 3
3 . . 5 . . . 7 . ... .


The . = empty not filled in by the user!

or OPTION 2:
userId keys
1 3
1 30
1 11
1 3
1 1
1 2
1 76
1 10
..
1 54

2 3
2 3
2 11
2 14
2 12
2 3

3 5
3 7


If you want to search for users with almost the same input. What is the easyest way? Option 1 or 2? And second question what is faster can sql bether search for column or rows?

Thanxx
Bjorn

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2004-02-04 : 07:34:16
Option 2 definitely. It normalized, and you can have unlimited keys. When you add more keys later in Option 1, you will have to change your INSERT statements. Also, writing a query to find (for example) all keys not filled in by the user is trivial is option 2, but would require 45 WHERE clauses in the first.


OS
Go to Top of Page

neutcomp
Posting Yak Master

111 Posts

Posted - 2004-02-04 : 07:46:08
quote:
Originally posted by mohdowais

Option 2 definitely. It normalized, and you can have unlimited keys. When you add more keys later in Option 1, you will have to change your INSERT statements. Also, writing a query to find (for example) all keys not filled in by the user is trivial is option 2, but would require 45 WHERE clauses in the first.


OS



Oke thanxx So I know now what structure I have to use OPTION 2.

Thanxx again
Bjorn
Go to Top of Page
   

- Advertisement -