Home >Database >Mysql Tutorial >How to Resolve 'Unrecognized name: employees at [9:8]' Error in BigQuery?
Error: "Unrecognized name: employees at [9:8]"
You may encounter an "Unrecognized name: employees at [9:8]" error when using table aliases. Let us analyze its causes and provide the right solutions.
Error analysis:
In the provided SQL query:
<code class="language-sql">SELECT employees.name AS employee_name, employees.role AS employee_role, departments.name AS department_name FROM `strange-calling-318804.employee_data.Employees` JOIN `strange-calling-318804.employee_data.departments` ON employees.department_id = departments.department_id</code>
uses ON
and employees
in a departments
clause Alias:
<code class="language-sql">ON employees.department_id = departments.department_id</code>
However, the Employees
and departments
tables do not have aliases explicitly defined in the FROM
clause. This caused the error because BigQuery requires that aliases must be defined before they can be used.
Solution:
To resolve this error, aliases must be defined before using them:
<code class="language-sql">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</code>
By adding the aliases AS employees
and AS departments
after the full table reference, queries now correctly identify the table and execute without errors.
The above is the detailed content of How to Resolve 'Unrecognized name: employees at [9:8]' Error in BigQuery?. For more information, please follow other related articles on the PHP Chinese website!