Efficient bulk update and insert
✓ Published0🌍 Public
Aandrewxhill
Last edited Jun 5, 2013
Created on Jun 5, 2013
This example demonstrates two efficient SQL patterns for bulk loading election results into a CartoDB table named `counties_results`. The `insert.sql` file shows how to add new rows using a single `INSERT INTO ... VALUES` statement with multiple tuples, while `update.sql` performs a bulk update by joining the table against a `FROM (VALUES ...)` clause, matching records on `st_usps` and `fips`. Both files contain identical county-level presidential vote percentage data, including Democratic, Republican, and other party shares, ready to be applied to a spatial database.
AI-generated descriptionBulk insert or update CartoDB records
Use the SQL example here to efficiently update CartoDB tables. See both the INSERT and UPDATE variants