MySQL raises error 1096 (ER_NO_TABLES_USED) when a statement that requires at least one table references none.
MySQL error 1096: ER_NO_TABLES_USED appears when a query such as SELECT, DELETE, or UPDATE is written without referencing any table. Add a valid table in the FROM, DELETE FROM, or UPDATE clause, or rewrite the statement as a table-free SELECT allowed by MySQL to resolve the issue.
No tables used
MySQL throws error code 1096 with the message “No tables used” when a statement that normally needs a table is written without one. The parser stops, because it cannot build a query plan that references rows.
This differs from a literal-only SELECT such as SELECT 1;
, which MySQL permits. The error appears on statements like DELETE
, UPDATE
, or SELECT ...
INTO OUTFILE
where table access is mandatory.
The error is triggered by a missing table reference in the FROM clause or target list. It also occurs when you alias a subquery and later remove it, or when you accidentally delete the table name while refactoring SQL in editors such as Galaxy.
Add at least one valid table to the statement. For DELETE or UPDATE, specify the table after the keyword.
For SELECT, include a FROM clause. Confirm that any required JOINs, aliases, or subqueries still exist.
Running DELETE;
returns error 1096 - rewrite to DELETE FROM users;
. Exporting to CSV with SELECT INTO OUTFILE '/tmp/u.csv';
fails - rewrite to SELECT * FROM users INTO OUTFILE ...;
.
Use code linters in your IDE to flag missing FROM clauses. In Galaxy, enable real-time syntax validation to catch the omission before execution.
Always run unit tests on generated SQL strings in application code.
Error 1064 (Syntax error) fires on broader grammar mistakes. Error 1146 (Table doesn’t exist) occurs when the table name is present but missing in the schema. Both differ from 1096, which is triggered by no table at all.
.
No. MySQL allows constant-only SELECT statements without a FROM clause.
DELETE requires a table to remove rows from. Omitting the table makes the command ambiguous.
Galaxy’s editor validates SQL in real time and flags missing table references before the query runs.
Error 1096 exists in all modern MySQL versions, including 5.7, 8.0, and MariaDB forks.