Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 使用';时删除限定符错误;使用';_Sql_Oracle - Fatal编程技术网

Sql 使用';时删除限定符错误;使用';

Sql 使用';时删除限定符错误;使用';,sql,oracle,Sql,Oracle,我的代码 根据Oracle提供的数据 我想获得所有参加爱因斯坦教授课程的学生的ID。 但我得到一个错误列,using子句的一部分不能有限定符 我怎样才能修改代码 表格样本 学生 指导员 教导 接受 在Oracle中,您必须像下面这样加入 ID COURSE_ID SEC_ID SEMESTER YEAR GRADE 00128 CS-101 1 Fall 2009 A 00128 CS-347 1 Fall 2009 A-

我的代码

根据Oracle提供的数据

我想获得所有参加爱因斯坦教授课程的学生的ID。

但我得到一个错误列,using子句的一部分不能有限定符

我怎样才能修改代码

表格样本

学生

指导员

教导

接受


在Oracle中,您必须像下面这样加入

ID      COURSE_ID SEC_ID SEMESTER YEAR  GRADE
00128   CS-101    1      Fall   2009    A
00128   CS-347    1      Fall   2009    A-
12345   CS-101    1      Fall   2009    C
你也可以尝试使用下面的方法,让我知道它是否有效

  select distinct st.id
  from student st join takes on st.id =takes.id
   join teaches tch 
   on tks.course_id=tch.course_id
   and tks.sec_id=tch.sec_id 
   and tks.semester=tch.semester 
   and tks.year=tch.year
   join instructor ins on 
   ins.id=tch.id
   where ins.name = 'Einstein'

在Oracle中,您必须像下面这样加入

ID      COURSE_ID SEC_ID SEMESTER YEAR  GRADE
00128   CS-101    1      Fall   2009    A
00128   CS-347    1      Fall   2009    A-
12345   CS-101    1      Fall   2009    C
你也可以尝试使用下面的方法,让我知道它是否有效

  select distinct st.id
  from student st join takes on st.id =takes.id
   join teaches tch 
   on tks.course_id=tch.course_id
   and tks.sec_id=tch.sec_id 
   and tks.semester=tch.semester 
   and tks.year=tch.year
   join instructor ins on 
   ins.id=tch.id
   where ins.name = 'Einstein'

请显示样本数据和所需结果。“不清楚这些表的结构是什么。”戈登林诺夫:我加的!请显示样本数据和所需结果。“不清楚这些表的结构是什么。”戈登林诺夫:我加的!我添加了表格样本,你能检查一下吗?我已经修改了查询plz检查now@psaraj12 . . . 你能解释一下为什么“你必须使用
加入
”吗?Oracle肯定支持
using
子句,因此答案并不明确。(显然,
on
子句起作用,但不清楚为什么
using
子句不起作用。)@GordonLinoff教师和教师的ID匹配和学生的ID匹配,我已经提到了使用特定的左连接作为示例I add table sample你会检查它吗plz?我已经修改了查询plz检查now@psaraj12 . . . 你能解释一下为什么“你必须使用
加入
”吗?Oracle肯定支持
using
子句,因此答案并不明确。(显然,
on
子句起作用,但不清楚为什么
using
子句不起作用。)@GordonLinoff教师和教师匹配的ID以及学生和Takes匹配的ID,我已经提到了使用的特定左连接作为示例
ID      COURSE_ID SEC_ID SEMESTER YEAR  GRADE
00128   CS-101    1      Fall   2009    A
00128   CS-347    1      Fall   2009    A-
12345   CS-101    1      Fall   2009    C
  select distinct st.id
  from student st join takes on st.id =takes.id
   join teaches tch 
   on tks.course_id=tch.course_id
   and tks.sec_id=tch.sec_id 
   and tks.semester=tch.semester 
   and tks.year=tch.year
   join instructor ins on 
   ins.id=tch.id
   where ins.name = 'Einstein'
    select distinct student.id
    from student left join takes using(id)
    left join teaches using(course_id, sec_id, semester, year)
    left join instructor using(id) 
    where instructor.name = 'Einstein'