Common SQL Errors

MySQL Error 1096: ER_NO_TABLES_USED - How to Fix and Prevent

Galaxy Team
August 5, 2025

MySQL raises error 1096 (ER_NO_TABLES_USED) when a statement that requires at least one table references none.

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error 1096 (ER_NO_TABLES_USED)?

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.

Error Highlights

Typical Error Message

No tables used

Error Type

Syntax Error

Language

MySQL

Symbol

ER_NO_TABLES_USED

Error Code

1096

SQL State

Explanation

Table of Contents

What is MySQL error 1096 (ER_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.

What Causes This Error?

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.

How to Fix MySQL Error 1096

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.

Common Scenarios and Solutions

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 ...;.

Best Practices to Avoid This Error

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.

Related Errors and Solutions

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.

.

Common Causes

Related Errors

FAQs

Does SELECT 1; trigger error 1096?

No. MySQL allows constant-only SELECT statements without a FROM clause.

Why does DELETE without FROM fail?

DELETE requires a table to remove rows from. Omitting the table makes the command ambiguous.

How can Galaxy prevent this error?

Galaxy’s editor validates SQL in real time and flags missing table references before the query runs.

Is this error version-specific?

Error 1096 exists in all modern MySQL versions, including 5.7, 8.0, and MariaDB forks.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo