#mysql Clear
Tags #php #kotlin #bash #go #sql #rust #typescript #html #java #python #files #utils #strings #http #concurrency #async #json #arrays #security #types #crypto #database #dates #format
PHP UPSERT (INSERT ... ON DUPLICATE KEY UPDATE)
A MySQL upsert helper: insert a row, or if a unique key collides, update the same row with the new values. Returns whether the row was inserted (true) or updated (false).
PHP PDO Schema Existence Checks
Idempotent helpers to test whether a table, column, or index already exists — handy when writing your own migration runner without an ORM.
PHP PDO Connection with Sensible Defaults
Open a PDO connection with all the options you almost always want: real prepared statements, exceptions on error, associative-array fetch mode, UTF-8 charset.
SQL Generated / Computed Columns
A column whose value is derived from other columns and maintained automatically. PostgreSQL has STORED (persisted) and MySQL adds VIRTUAL (computed on read). Saves you from triggers for derived data.
SQL UPDATE with JOIN
Update one table using values from another. Syntax varies by database — PostgreSQL uses `FROM`, MySQL puts the join in the `UPDATE` clause.
SQL UPSERT — MySQL ON DUPLICATE KEY UPDATE
MySQL's flavor of upsert. Triggers when an INSERT would violate a PRIMARY KEY or UNIQUE constraint. Use `VALUES()` (or `NEW.col` in MySQL 8.0.20+) to reference the would-be-inserted row.