Skip to content
Skills Library
Programming · Learning & explanation

mariadb-drop-table

/mariadb-drop-table

MariaDB-specific syntax and behavior for DROP TABLE — RESTRICT/CASCADE being no-ops, the DROP TEMPORARY TABLE guard against dropping a same-named base table, partial drops in a multi-table statement, IF EXISTS warning behavior, failure when a table is referenced by a foreign key, DROP TABLE on a view, automatic trigger removal, implicit-commit (and the DROP TEMPORARY exception), WAIT/NOWAIT, and CREATE OR REPLACE TABLE as the atomic replace. Use when writing, generating, or reviewing DROP TABLE statements that target MariaDB.

Repository
ai-plugins ↗
Licence
LGPL
Last repository change
12.11.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
1
Deprecation

No signals detected. Repository changed on 12.11.2026, without references to retired models or APIs.

Licence

LGPL, otwarta.

What it does and when to use it

MariaDB-specific syntax and behavior for DROP TABLE — RESTRICT/CASCADE being no-ops, the DROP TEMPORARY TABLE guard against dropping a same-named base table, partial drops in a multi-table statement, IF EXISTS warning behavior, failure when a table is referenced by a foreign key, DROP TABLE on a view, automatic trigger removal, implicit-commit (and the DROP TEMPORARY exception), WAIT/NOWAIT, and CREATE OR REPLACE TABLE as the atomic replace. Use when writing, generating, or reviewing DROP TABLE statements that target MariaDB.

Original author description

MariaDB-specific syntax and behavior for DROP TABLE — RESTRICT/CASCADE being no-ops, the DROP TEMPORARY TABLE guard against dropping a same-named base table, partial drops in a multi-table statement, IF EXISTS warning behavior, failure when a table is referenced by a foreign key, DROP TABLE on a view, automatic trigger removal, implicit-commit (and the DROP TEMPORARY exception), WAIT/NOWAIT, and CREATE OR REPLACE TABLE as the atomic replace. Use when writing, generating, or reviewing DROP TABLE statements that target MariaDB.

How it works

  1. What LLMs Often Miss
  2. Syntax
  3. See Also
Original SKILL.md headings · 60 lines, 695 words
SKILL.md preview
---
name: mariadb-drop-table
description: "MariaDB-specific syntax and behavior for DROP TABLE — RESTRICT/CASCADE being no-ops, the DROP TEMPORARY TABLE guard against dropping a same-named base table, partial drops in a multi-table statement, IF EXISTS warning behavior, failure when a table is referenced by a foreign key, DROP TABLE on a view, automatic trigger removal, implicit-commit (and the DROP TEMPORARY exception), WAIT/NOWAIT, and CREATE OR REPLACE TABLE as the atomic replace. Use when writing, generating, or reviewing DROP TABLE statements that target MariaDB."
---

# DROP TABLE in MariaDB

*Last updated: 2026-06-24*

This skill covers the **delta between standard SQL `DROP TABLE` and MariaDB's**. It assumes the agent knows the basic `DROP TABLE t;` form. Everything below documents MariaDB-specific behavior and the traps that bite generated SQL.

> **Default context:** Assume MariaDB **11.8 LTS** (GA May 2025) unless the user states another version. Anything available in current LTS branches (10.6, 10.11, 11.4, 11.8) is shown without a "since" annotation; only newer-than-10.6 features carry one.

## What LLMs Often Miss

| If the agent writes / assumes… | …prefer the MariaDB form |
|---|---|
| Adds `CASCADE` expecting dependent objects (FK children, etc.) to be dropped too | `RESTRICT` and `CASCADE` are **parsed but do nothing** on `DROP TABLE` — accepted only for portability. Nothing cascades. To remove a referencing foreign key, drop or alter that table explicitly |
| Bare `DROP TABLE x` to discard a temporary table | `DROP TEMPORARY TABLE x` — `TEMPORARY` restricts the drop to temporary tables, so a stray base table of the same name can never be dropped by accident. The safer form whenever you mean a temp table |
| Assumes one missing table aborts `DROP TABLE a, b, c` and leaves the rest | **Partial drop**: the tables that exist are still dropped; the missing ones are collected and reported together at the end. Without `IF EXISTS` you get both the drops *and* an error |
| Expects `DROP TABLE IF EXISTS missing` to still error | `IF EXISTS` turns the unknown-table error into a **note-level warning** (visible via `SHOW WARNINGS`) — not an error, not silent |
| `DROP TABLE v` where `v` is a view | Errors (`ER_IT_IS_A_VIEW`) — use `DROP VIEW v`. (See `mariadb-create-view`) |
| Drops a table that another table's foreign key references | Blocked (`ER_ROW_IS_REFERENCED`). Drop the referencing FK first, or `SET foreign_key_checks = 0` for the session to bypass the check |
| Wraps `DROP TABLE` in a transaction expecting to roll it back | DDL does an **implicit commit** — it can't be rolled back. The one exception: `DROP TEMPORARY TABLE` does *not* implicitly commit the surrounding transaction |
| Drops a table, then separately hunts down its triggers | `DROP TABLE` removes the table's triggers automatically — no separate `DROP TRIGGER` needed |
| `DROP TABLE x; CREATE TABLE x …` to replace a table definition | `CREATE OR REPLACE TABLE x …` — from 13.2 atomic by default (no window where the table is missing), except where the old table is dropped first; before 13.2 it is only crash-safe. See `mariadb-create-table` |
| Uses `DROP TABLE` to clear rows or reset `AUTO_INCREMENT` | That destroys the table. To empty it, use `TRUNCATE TABLE` (resets `AUTO_INCREMENT`, implicit commit) or `DELETE FROM` (transactional). See `mariadb-delete` |

## Syntax

```sql
DROP [TEMPORARY] TABLE [IF EXISTS]
    tbl_name [, tbl_name] …
    [WAIT n | NOWAIT]
    [RESTRICT | CASCADE];
```

Clause order is load-bearing: `WAIT`/`NOWAIT` comes **after** the table list and **before** the (no-op) `RESTRICT`/`CASCADE`. `TABLE` and `TABLES` are interchangeable.

```sql
-- Missing tables tolerated as warnings:
DROP TABLE IF EXISTS employees, customers;

-- Guard against dropping a same-named base table:
DROP TEMPORARY TABLE IF EXISTS scratch;

-- Qualified names can span databases in one statement:
DROP TABLE app.sessions, archive.sessions;

-- Bound the metadata-lock wait instead of blocking:
DROP TABLE big_table WAIT 5;     -- or NOWAIT to fail immediately
```

`WAIT n` / `NOWAIT` sets the lock-wait timeout for the statement — useful when a long-held metadata lock would otherwise make the `DROP` block. A single-table `DROP TABLE` is atomic (crash-safe) on InnoDB/Aria/MyISAM; in a multi-table drop each individual table drop is atomic, but the statement as a whole is **not** all-or-nothing.

## See Also

- **`mariadb-create-table`** — `CREATE OR REPLACE TABLE` (the atomic replace) and the shared implicit-commit / atomic-DDL behavior
- **`mariadb-create-view`** — `DROP VIEW` for views (`DROP TABLE` won't drop them)
- **`mariadb-delete`** — when you want to *empty* a table rather than drop it: `TRUNCATE TABLE` vs `DELETE FROM`
- Canonical reference on `mariadb.com/docs`, consult only for edge cases not covered here: <https://mariadb.com/docs/server/reference/sql-statements/data-definition/drop/drop-table>

<sub>_This page is: Copyright © 2026 MariaDB. All rights reserved._</sub>

Versions

RepositoryScoreLicence
This page · mariadb-corporation/ai-plugins100LGPL
mariadb-corporation/ai-plugins100LGPL

Database snapshot: 13.11.2026 · package version 533049bdace1 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100mariadb-rename-table
    MariaDB-specific syntax and behavior for RENAME TABLE — atomic multi-table renames executed left-to-right with full rollback on any failure (enabling the classic swap trick), works directly on TEMPORARY tables (no ALTER TABLE needed), refuses to run inside an active transaction…
  • 100mariadb-create-table
    MariaDB-specific syntax and behavior for CREATE TABLE — atomic CREATE OR REPLACE, INVISIBLE / COMPRESSED columns, system-versioned and application-time PERIOD clauses, IGNORED indexes, table-level encryption, page compression, sequence and Aria table options, and the…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.