RETURNING clause: have your cake and eat it too
summary
MariaDB adds a RETURNING clause that returns inserted, replaced or deleted rows so you avoid a separate SELECT: INSERT ... RETURNING and REPLACE ... RETURNING arrive in Server 10.5 while DELETE ... RETURNING is available since 10.0. RETURNING can output columns, virtual columns, aliases, expressions (bitwise, arithmetic, logical), functions, subqueries and prepared statements. Examples show using auto_increment and defaults to get generated customer_id, using INSERT IGNORE or ON DUPLICATE KEY UPDATE to see what changed, and DELETE ... RETURNING to move customers with credit_score < 700 into another table.
AI-written summary · about
chapters (5)
related talks
34mCommon Table Expressions and Window Functions simple, maintainable, fast queries
40mMaking the most out of MySQL
44mBeyond WHERE and GROUP BY
53mMariaDB Server 10.2: The Complete Guide
53mBreakout Session
25mBillions of Records in MySQL: Lessons Learned
47mSql table as a queue - what could go wrong?
02h 42mSQL (The Return): Demystifying Preconceptions and Using the DB Effectively
