《數據庫》 錯誤 ~1248 - Every derived table must have its own alias~

解決問題:「顯示Comp. Sci. 系全部學生以及他們在2009年春季選修課的全部課程端的列表」ci

(1)錯誤源頭:it

select * from (select * from student where dept_name='Comp. Sci.')
     natural  left outer join            //左外鏈接
    (select * from takes where semester='Spring' and year=2009);table

錯誤緣由:
1248 - Every derived table must have its own alias
//這句話的意思是說每一個派生出來的表都必須有一個本身的別名
//通常在多表查詢時,會出現此錯誤。select

(2)改正:
select * from (select * from student where dept_name='Comp. Sci.') as a
     natural left outer join
    (select * from takes where semester='Spring' and year=2009) as b;查詢

 

推展:natural  right outer join  //右外鏈接(與左外鏈接相對稱)tab

        natural full outer join      // 全外鏈接join

        natural join                   //天然鏈接錯誤

相關文章
相關標籤/搜索