求该SQL题目翻译和答案每一步的意义或者解释,最后再教教我narural join是什么,谢谢!!
FindtheenrollmentofeachsectionthatwasofferedinAutumn2009.Onewayofwritingthequeryisasf...
Find the enrollment ofeach section that was offered in Autumn 2009.
One way of writing the query is as follows.
select course id, sec id, count(ID)
from section natural join takes
where semester = ’Autumn’
and year = 2009
group by course id, sec id 展开
One way of writing the query is as follows.
select course id, sec id, count(ID)
from section natural join takes
where semester = ’Autumn’
and year = 2009
group by course id, sec id 展开
1个回答
展开全部
查询2009年秋季各部门登记情况?翻译不咋地
select course id, sec id, count(ID) --课程号,部门号,计数from section natural join takes where semester = ’Autumn’ --学期为秋季and year = 2009 --年份为2009group by course id, sec id --按课程号与部门号分组
narual join就是2表连接时不写连接条件,而自动使用2表同名的列进行等值连接,如
select dept.*, emp.* from dept natural join emp 就等同于
select dept.*, emp.* from dept join emp on dept.deptno=emp.deptno,因为dept与emp两表有一个同名的列deptno
有多个同名列时都会自动进行等值连接,同名不同类型可能会出错
select course id, sec id, count(ID) --课程号,部门号,计数from section natural join takes where semester = ’Autumn’ --学期为秋季and year = 2009 --年份为2009group by course id, sec id --按课程号与部门号分组
narual join就是2表连接时不写连接条件,而自动使用2表同名的列进行等值连接,如
select dept.*, emp.* from dept natural join emp 就等同于
select dept.*, emp.* from dept join emp on dept.deptno=emp.deptno,因为dept与emp两表有一个同名的列deptno
有多个同名列时都会自动进行等值连接,同名不同类型可能会出错
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询