Weekly - issue 42

How to copy files from a Docker container to the host

docker cp my_container:/home/user/file.jpg file.jpg

Upsert in SQL

Upsert is an operation that inserts new records into the database and updates existing ones.

  • MySQL / MariaDB

    INSERT...ON DUPLICATE KEY UPDATE
  • SQLite

    INSERT...ON CONFLICT
  • PostgreSQL

    INSERT...ON CONFLICT
    
    -- Only PostgreSQL 15+
    MERGE...INTO
  • SQL Server (2008+) / Oracle (11+)

    MERGE...INTO