因此,基本上,我正在关注一个教程问题,该问题问我以下内容。我不太确定如何联接不包含其他FK的2个表,它们(即它们的两个FK)都位于第3个表中。我可以得到一些帮助/解释吗?
我的答案
SELECT Forest.Fo_name, Species.Sp_name, Species.Sp_woodtype
FROM Forest
INNER JOIN Species
ON Tree.Tr_species=Tree.Tr_forest
WHERE Fo_loc='ARTIC'
ORDER BY Fo_name, Sp_name
“对于在编码为“ ARTIC”的区域中找到的森林,列出其中找到的森林名称和物种名称以及物种木材类型。消除任何重复,并按森林名称和物种名称对输出进行排序”
种类表
+--------------+------------------+------+--------------------------------+
| Field | Type | Key | Glossary |
+--------------+------------------+------+--------------------------------+
| sp_name | C(10) | PK | Species Name |
| sp_woodtype | C(10) | | Wood Yielded by tree |
| sp_maxht | I | | Max. Height |
+--------------+------------------+------+--------------------------------+
森林表
+--------------+------------------+------+--------------------------------+
| Field | Type | Key | Glossary |
+--------------+------------------+------+--------------------------------+
| Fo_name | C(10) | PK | Forest Name |
| Fo_size | I | | Forest Area |
| Fo_loc | C(10) | | Geographical Area |
| Fo_comp | C(10) | | Forest Owner |
+--------------+------------------+------+--------------------------------+
C(10)&我分别代表字符(10)和Integer
相关分类