[thelist] dynamic table sql question

Sarah Sweeney mr.sanders at designshift.com
Thu Apr 28 08:50:25 CDT 2005


> : >    Well, my first reaction would be "why the heck did they design the
> : database this way", but since I doubt you have any control over that,
> : let's press on.
> : 
> : It actually makes perfect sense.  Each Job is from a different client,
> : upon which we are calling on THEIR lists for them.

Instead of having a different table for each clients' jobs, like this:

tblClientAJobs
--------------
JobID
JobTitle
etc

tblClientBJobs
--------------
JobID
JobTitle
etc

tblClientCJobs
--------------
JobID
JobTitle
etc

Just have a client table and a jobs table, like this:

tblClients
----------
ClientID
ClientName
etc

tblJobs
-------
JobID
ClientID
JobTitle
etc

Then you'd have a one to many relationship between tblClients and 
tblJobs. That's why we have relational databases - so we can create 
relationships between the tables.

To me, this feels like stating the obvious, but for someone just 
starting out with relational databases and data normalization, it 
probably isn't so obvious. Hopefully the OP is able (and allowed) to 
implement a simpler and more elegant solution than what he is currently 
working with.

-- 
sarah sweeney
web developer & programmer
my portfolio: http://sarah.designshift.com
my blog: http://hardedge.ca
my family: http://geekjock.ca


More information about the thelist mailing list