database design - SQL - Linking two tables -


i have 2 tables, specifically, contain standard , specific parameters respectively.

table1:

pkparameter     name        unit      1       temperature     k      2         length        mm      3        pressure       bar 

table2:

 pkspecparam      name       unit      1           weight       kg      2            area        m2 

pkparameter ans pkspecparameter primary keys

i combine these 2 tables third table keep track of primary keys can reference of parameters, regardless of table from.

for example:

pkcombined     pkparameter    pkspecparameter      1              1               null      2              2               null      3              3               null      4             null              1      5             null              2  

now use pkcombined primary key reference parameter maybe there better way this, i've started meddling databases.

select a.pkparameter , a.name,a.unit,b.pkspecparam  , b.name,b.unit   table1 outer join table2 b on a.pkparameter=b.pkspecparam 

however, give out null values if number of entries in pkparameter , pkspecparam dont match


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -