SQL错误:为什么测试表不存在?

时间:2018-04-06 16:44:55

标签: mysql error-handling

我正在Leetcode网站上进行SQL练习,我遇到的一个常见错误是

'test table xxx doesn't exist'

我看到有人提到我没有这些表的许可,但我不明白为什么。在什么情况下我会失去对测试表的许可?例如,代码中的哪些特定错误可能导致此问题?谢谢!

补充:例如,我试图通过以下代码解决184. Department Highest Salary leetcode问题:

select d.Name as "Department", e.Name as "Employee", Salary
from Empolyee e
join Department d
on d.Id = e.DepartmentId
where (e.DepartmentId , Salary) in (select DepartmentId, max(Salary)
                                  from Employee
                                  group by DepartmentId)

我收到的错误是:

Table 'test.empolyee' doesn't exist

但是,以下代码(与我上面的代码非常相似)是正确的!谁知道为什么?谢谢!

SELECT Department.name AS 'Department',
       Employee.name AS 'Employee',
       Salary
FROM Employee
JOIN Department 
ON Employee.DepartmentId = Department.Id
WHERE (Employee.DepartmentId , Salary) IN (SELECT DepartmentId, MAX(Salary)
                                          FROM Employee
                                          GROUP BY DepartmentId)

0 个答案:

没有答案