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
How to Return the Column Names of a Table
Select Row With Most Recent Date Per User
How to Do a Case Sensitive Search in Where Clause (I'M Using SQL Server)
Spark SQL Window Function With Complex Condition
SQL Server - in Clause With a Declared Variable
How to Run a SQL Query on an Excel Table
How to Replace a String in a SQL Server Table Column
Constraint Defined Deferrable Initially Immediate Is Still Deferred
How to Log SQL Statements in Grails
Run All SQL Files in a Directory
Most Efficient T-SQL Way to Pad a Varchar on the Left to a Certain Length
How to Find Gaps in Sequential Numbering in MySQL
How to Use Variables in Oracle SQL Developer
Group by Behavior When No Aggregate Functions Are Present in the Select Clause
Db2 Comma Separated Output by Groups
Alter a MySQL Column to Be Auto_Increment
Getting All Buildings in Range of 5 Miles from Specified Coordinates