Unrecognized Name: Employees At [9:8]

Unrecognized name: employees at [9:8]

you are missing aliases employees and departments after full table references! you use them in ON clause but you missed to define them!

SELECT 
employees.name AS employee_name,
employees.role AS employee_role,
departments.name AS department_name
FROM
`strange-calling-318804.employee_data.Employees` as employees
JOIN
`strange-calling-318804.employee_data.departments` as departments
ON employees.department_id = departments.department_id

How to solve an error with JOIN tables in SQL?

You have a trailing ` mark on line 7 that you should eliminate. Also, try using aliases:

SELECT
employees.name as employee_name,
employees.role as employee_role,
departments.name as department_name
FROM `potent-electron-345605.employee_data.employees` AS E
INNER JOIN employee_data.departments AS D
ON E.department_id = D.department_id

BigQuery error message help, I'm a beginner. Table name missing dataset?? What can I try to remedy this?

I'm doing the same course and I ran into this exact error. One thing to note is that you can't mix and match table reference styles, meaning if you included the full path that BigQuery tends to auto-fill in back-ticks in at least one spot, then you need to use that style everywhere. This includes all the column names in the SELECT clause and the table names in the FROM and JOIN clauses. If you've tried the back-ticks in parts of your code but not everywhere, that might explain why it wasn't running.

SELECT 
`esoteric-cider-333608.employee_data.employees`.name AS employee_name,
`esoteric-cider-333608.employee_data.employees`.role AS employee_role,
`esoteric-cider-333608.employee_data.departments`.name AS department_name
FROM
`esoteric-cider-333608.employee_data.employees`
INNER JOIN
`esoteric-cider-333608.employee_data.departments`
ON
`esoteric-cider-333608.employee_data.employees`.department_id = `esoteric-cider-333608.employee_data.departments`.department_id;

A better way of doing this is to alias the table names. You can do this the same way you alias column names in the SELECT clause by using the AS keyword. Now you can refer to the table in shorthand throughout your statement and BigQuery will have an exact definition for the "departments" table.

SELECT 
employees.name AS employee_name,
employees.role AS employee_role,
departments.name AS department_name
FROM
`esoteric-cider-333608.employee_data.employees` AS employees
INNER JOIN
`esoteric-cider-333608.employee_data.departments` AS departments
ON
employees.department_id = departments.department_id;

For more information about aliases visit https://www.w3schools.com/sql/sql_alias.asp.



Related Topics



Leave a reply



Submit