Database Column vs String Concatenation
Please tell me which out of the 2 solutions is a better solution and why?
I need to store 2 values of String type in the database
Value1 - GUID
Value2 - Reference Number
Record1 : asdasdsadsa12345
Record2 : dggtghknklkll12345
where 12345 is the reference number and the remaining part of the value is the GUID.
I can concatenate both the strings and store that in one column in the database and make it the primary key.
I can create 2 columns in the database and store both the values differently
Make GUID the primary key column and use the other column to store the Reference Number.
I feel solution 2 is better as solution 1 will force to concatenate string while creating a record and while retrieving a record substring will be required , which does not represent a good design.
Also, solution 2 will enable us to query the second column to retrive records efficiently.