SQLの結合について
現在、SQLの結合についての課題にとりくでいるのですが、paizaで
ERROR 1052 (23000) at line 17: Column 'departmentid' in on clause is ambiguous
この様なエラー表示が出てしまい、修正方法を教えて頂けないでしょうか?
「課題」
問2 テーブルの結合
以下の情報を取得するSQLを作成してください。
部署名、社員名
「ソースコード」
create table employees(employeeid integer PRIMARY KEY,
departmentid integer,
employeename varchar(100),
height integer,
weight integer);
INSERT INTO employees(employeeid, departmentid, employeename, height, weight) VALUES(11, 1, '後藤', 170, 50);
INSERT INTO employees(employeeid, departmentid, employeename, height, weight) VALUES(12, 2, '齋藤', 180, 90);
INSERT INTO employees(employeeid, departmentid, employeename, height, weight) VALUES(13, 3, '山田', 165, 70);
create table departments(departmentid integer PRIMARY KEY,
departmentname varchar(100));
INSERT INTO departments(departmentid, departmentname) VALUES(1, 'チームA');
INSERT INTO departments(departmentid, departmentname) VALUES(2, 'チームB');
INSERT INTO departments(departmentid, departmentname) VALUES(3, 'チームC');
SELECT employeename, departmentname FROM employees INNER JOIN departments ON departmentid = departmentname;
SELECT employeename, departmentname FROM employees LEFT OUTER JOIN departments ON departmentid = departmentname;