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.
| Author |
Topic |
|
sampath
Starting Member
1 Post |
Posted - 2012-06-10 : 23:03:30
|
| HiI am preparing the database of mall's which tells the number of mall's in a city in different locations.For example**Mall** **Places**Inorbit gachibowli, mehdipatnam, hitech-city,a,b,c,d,e,fGVK Mall gachibowli, secunderabad, machlipatnam,x,yx,z,iThis way I want to display the number of places the mall is present in a state when user selects a mall. But the number of places in which a mall is present are numerous and the number of places one mall is present will vary by huge number. So I want to know can this be done without creating huge number of columns to accommodate places in which a mall exist. I also want to display the mall's in a location when user selects a particular please.I hope the question is understandable.sampath |
|
|
vinu.vijayan
Posting Yak Master
227 Posts |
Posted - 2012-06-11 : 03:22:41
|
quote: **Mall** **Places**Inorbit gachibowli, mehdipatnam, hitech-city,a,b,c,d,e,fGVK Mall gachibowli, secunderabad, machlipatnam,x,yx,z,i
Storing Data as Comma Delimited String is not a good practice.This is a better alternative to your approach:quote: **Mall** **Places**Inorbit gachibowliInorbit mehdipatnamInorbit hitech-cityInorbit aInorbit bInorbit cInorbit dInorbit eInorbit f
What would be best is for you to have a master table for Places which has PlaceId as Primary Key and PlaceName as another field.Then you can have a table Malls where you can have MallId as Primary Key, PlaceId as Foreign Key which references the Places Master Table and MallName as another Field.This should be the ideal Structure. Comma Delimited Strings should always be avoided as a medium of Storing data in Databases.Hope that helps.N 28° 33' 11.93148"E 77° 14' 33.66384" |
 |
|
|
waterduck
Aged Yak Warrior
982 Posts |
Posted - 2012-06-11 : 04:37:21
|
| use garmin or papago =P |
 |
|
|
|
|
|
|
|