We read your photo as:

How do I fix the SQL error 'Table 'I220131570.Job' doesn't exist' and what are the correct SQL commands to delete records based on hire date?

Computer Science

ScanSolve AI Answer

Answer

The error ERROR 1146 (42S02): Table 'I220131570.Job' doesn't exist indicates that the table name you provided in the DELETE statement is incorrect or does not exist.

Step-by-step solution

2 steps

Looking at your command: DELETE FROM Job Title WHERE EmpID IN (...), you have a space between Job and Title. SQL interprets Job as the table name and Title as an unexpected keyword or alias, leading to the error.

The table name is likely JobTitle (without a space).

Here are the corrected commands:

  1. Delete records from the JobTitle table that reference employees hired before '2017-01-01'.

    DELETE FROM JobTitle WHERE EmpID IN (SELECT EmpID FROM Employee WHERE HireDate < ’2017-01-01’);\text{DELETE FROM JobTitle WHERE EmpID IN (SELECT EmpID FROM Employee WHERE HireDate < '2017-01-01');}
  2. After the dependent records are removed, delete the employee records from the Employee table.

    DELETE FROM Employee WHERE HireDate < ’2017-01-01’;\text{DELETE FROM Employee WHERE HireDate < '2017-01-01';}

    Execute these two commands in sequence.

Was this helpful?

Still stuck on this one?

Ask a follow-up, and the answer starts from this question.

Got a different question?Ask your own question
Handwritten step-by-step solution preview

Handwritten Step-by-Step Solution

Get this as a handwritten image on WhatsApp — like a tutor wrote it for you.

Try on WhatsApp