Snippets about sql

10 snippets

Back to all snippets

  1. SNP 140 #925

    Create a database user in MariaDB

    One user per application, with only the rights it needs.

  2. SNP 123 #952

    Update a table from another table

    Copy values across tables with a join, in MySQL, MariaDB and PostgreSQL.

  3. SNP 094 #591

    Upsert in PostgreSQL

    Insert a row, or update it if it already exists, in one statement.

  4. SNP 083 #962

    Tunnel to a remote database over SSH

    Use your local database tools on a server's database that isn't exposed to the internet.

  5. SNP 077 #396

    Delete duplicate rows but keep one

    Clean up a table after finding the duplicates, keeping the oldest of each.

  6. SNP 044 #A35

    Latest row per group in SQL

    The newest order of every customer, in one query.

  7. SNP 039 #952

    MariaDB in Docker for local development

    A database for the project that you can throw away and recreate in a second.

  8. SNP 033 #953

    Dump and restore a MariaDB database

    Backups, moving a database to another server, or copying production to your machine.

  9. SNP 024 #936

    Find duplicate rows in SQL

    Which emails are in the users table more than once?

  10. SNP 012 #951

    Concat IDs into a single field in SQL

    Here is how to merge multiple SQL rows into one, values separated by a comma.