Skip to content
🗄️

Databases & SQL Errors

50 errors

Common databases & sql errors and how to fix them.

50 / 50

  1. 1

    SQL Syntax Error

    The database parser could not understand your SQL because it contains a grammar mistake — a missing keyword, misplaced comma, or typo.

  2. 2

    Table Does Not Exist

    Your query references a table name that the database does not know about — it may be misspelled, in a different schema, or not yet created.

  3. 3

    Column Does Not Exist

    Your query references a column that does not exist in the specified table — it may be misspelled, not yet added, or in a different table.

  4. 4

    Connection Refused

    The database server is not running, not listening on the expected port, or not accepting connections from your host.

  5. 5

    Authentication Failed

    The database server refused your login because the username, password, or authentication method does not match.

  6. 6

    Unique Constraint Violation

    You attempted to insert or update a row with a value that already exists in a column marked UNIQUE or PRIMARY KEY.

  7. 7

    Foreign Key Constraint Violation

    You tried to insert or update a row with a foreign key value that does not match any primary key in the referenced table.

  8. 8

    NOT NULL Constraint Violation

    You attempted to insert or update a row without providing a value for a column marked NOT NULL.

  9. 9

    CHECK Constraint Violation

    You tried to insert or update a value that fails a CHECK constraint — a custom condition like `price > 0` or `age >= 18`.

  10. 10

    Deadlock Detected

    Two transactions are waiting for each other's locks, creating a circular dependency. The database detects this and kills one transaction.

  11. 11

    Lock Timeout

    Your transaction tried to acquire a lock but another transaction held it for longer than the timeout period.

  12. 12

    Connection Timeout

    The connection pool had no available connections and your request waited longer than the configured timeout.

  13. 13

    Data Type Mismatch

    The value you are inserting or comparing does not match the column's data type — e.g., text into an integer column.

  14. 14

    Division by Zero

    Your query contains a division operation where the denominator is zero, which is mathematically undefined.

  15. 15

    Out of Memory

    The database server exhausted available memory, often due to a query that returns or processes too much data.

  16. 16

    Query Timeout

    The query exceeded the configured statement timeout — it is taking too long to execute.

  17. 17

    Permission Denied

    The database user you are connected as does not have the necessary privileges (SELECT, INSERT, UPDATE, DELETE) on the table.

  18. 18

    Too Many Connections

    The database server's max_connections limit has been reached — no new connections can be opened.

  19. 19

    Invalid SQL Statement

    The statement you sent is not valid SQL or is not supported by the database in this context.

  20. 20

    Serialization Failure

    Under SERIALIZABLE isolation, the database detected a conflict between concurrent transactions and aborted one to maintain correctness.

  21. 21

    Value Too Long for Column

    You tried to insert a string that is longer than the column's maximum length (e.g., VARCHAR(50) but the value has 60 characters).

  22. 22

    Invalid Input Syntax

    The value you provided cannot be converted to the column's data type — e.g., 'abc' for an integer, or '2023-13-45' for a date.

  23. 23

    Missing FROM Clause Entry

    You used a column from a table that is not listed in the FROM clause or JOIN — the database does not know where to get it.

  24. 24

    Ambiguous Column Reference

    You referenced a column name that exists in more than one table in the query, without specifying which table.

  25. 25

    MongoDB Duplicate Key Error

    You attempted to insert a document with a value that violates a unique index in MongoDB — the value already exists.

  26. 26

    Redis WRONGTYPE Operation

    You tried to use a list command (e.g., LPUSH) on a key that holds a string, or a string command on a set — Redis enforces per-key types.

  27. 27

    Disk Full

    The server's disk has run out of space — the database cannot write new data, WAL logs, or temporary files.

  28. 28

    Transaction Rollback on Error

    An earlier statement in your transaction failed. The transaction is now in an aborted state and will not execute any more commands until you ROLLBACK.

  29. 29

    Invalid JSON Syntax

    The value you provided is not valid JSON — it has a syntax error like a missing quote, trailing comma, or unbalanced brace.

  30. 30

    Database Does Not Exist

    You tried to connect to a database that does not exist on the server — the name may be misspelled or the database not yet created.

  31. 31

    Connection timeout: database unreachable

    Your application tried to connect to the database but the connection timed out — the server may be down or network is blocked.

  32. 32

    Deadlock detected: transaction aborted

    Your transaction was chosen as the deadlock victim — another transaction holds a lock you need and vice versa.

  33. 33

    Transaction rollback: unhandled error in transaction

    A SQL statement failed inside your transaction and the database rolled back all changes — the error was not caught and handled.

  34. 34

    Cursor not closed: resource leak

    You opened a cursor but did not close it — the database keeps the cursor and its resources allocated until the session ends.

  35. 35

    Connection pool exhausted

    Your connection pool has no available connections — all are checked out and the acquire request timed out.

  36. 36

    Query timeout: statement took too long

    Your query ran longer than the configured timeout — the database cancelled it and returned a timeout error.

  37. 37

    Unique constraint violation: duplicate key

    You tried to insert a duplicate value in a column with a unique constraint — the database rejects the operation.

  38. 38

    SQL syntax error: unexpected token

    Your SQL has a syntax error — the database parser encountered an unexpected token and could not parse the statement.

  39. 39

    Invalid column reference: column does not exist

    Your SQL references a column name that is not in the table — the database reports an unknown column error.

  40. 40

    Table not found: relation does not exist

    Your SQL references a table name that does not exist — the database reports an unknown table or relation error.

  41. 41

    Ambiguous column reference in join

    Your join query references a column that exists in both joined tables without specifying which table — the database cannot resolve it.

  42. 42

    Invalid join type: unsupported join syntax

    Your SQL uses a join type or syntax the database does not recognize — the parser rejects the statement.

  43. 43

    Missing GROUP BY: non-aggregated column in aggregate query

    Your query mixes aggregated and non-aggregated columns without grouping — the database cannot determine which values to show.

  44. 44

    N+1 query problem: excessive queries in loop

    You fetch N records then issue one query per record to load related data — this results in N+1 queries instead of one join.

  45. 45

    SQL injection: unescaped user input in query

    You built a SQL string by concatenating user input — an attacker can inject SQL commands that the database executes.

  46. 46

    Missing index causes slow query

    Your query filters on a column with no index — the database does a full table scan, which is slow on large tables.

  47. 47

    Cartesian join: missing join condition

    Your JOIN is missing an ON clause — the database returns every combination of rows from both tables (Cartesian product).

  48. 48

    NULL comparison: unexpected query results

    Your WHERE clause uses = or != to compare with NULL — NULL comparisons always return unknown, not true or false.

  49. 49

    Transaction isolation level: dirty read or phantom

    Your transaction isolation level is too low — concurrent transactions can read uncommitted data or see phantom rows.

  50. 50

    Orphaned foreign key: referencing deleted parent

    Child rows reference parent IDs that no longer exist — the foreign key constraint is missing or was disabled.

← Back to errors