Hi there.
Could someone please tell me how would I structure this excel table in sql?
Thx in advance
Ben
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Wim SturkenboomRank #2,527 · 554 reputationPosted Oct 23, 2014, 8:31 PM EDT
A single table can do the trick
tbl
Name
DMmin
DMmax
CPmin
CPmax
RUPmin
RUPmax
If DM, CP and RUP are the same objects with a different name, use two tables
tblName
PK
Name
tblValues
PK
FK (links to tblName)
Description (DM, CP, RUP)
Min
Max
If DM, CP and RUP are totally different objects, you need 4 tables
tblName
PK
Name
tblDM
PK
FK (links to tblName)
SomeOtherDataForDM
...
...
Min
Max
tblCP
PK
FK (links to tblName)
SomeOtherDataForCP
...
...
Min
Max
tblRUP
PK
FK (links to tblName)
SomeOtherDataForRUP
...
...
Min
Max
Note that PK (the primary key) can be the name; in which case FK will also be the name and you can remove PK from the above table design.
PK and FK link the different tables together.
For the multiple table approach, a select query can look like
select
tblName.*,
tblDM.Min,
tblDM.Max,
tblCP.Min,
tblCP.Max,
tblRUP.Min,
tblRUP.Max
from tblName
left join tblDM on tblName.PK=tblDM.FK
left join tblCP on tblName.PK=tblCP.FK
left join tblRUP on tblName.PK=tblRUP.FK
Ben erasmus4 reputationPosted Oct 24, 2014, 4:09 AM EDT