我有一个名为 StudentSchool
的注入(inject)表,其中包含:
StudentSchoolID StudentId SchoolID
1 233 22
但现在我想制作具有复合主键的表,如下所示:
StudentId SchoolID
233 22
在第一种情况下,我选择使用
select * from StudentSchool
where (StudentId = 233) and (SchoolID = 22)
但在第二种情况下如何使用它,因为它是主键
最佳答案
我不确定我是否正确理解了这个问题。
如果您想要 StudentId 233 和 SchoolId 22 的学生,则与第一种情况相同的查询。
关于sql - 从具有复合主键的表中选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7146630/