Sample Databases - PostgreSQL wiki (original) (raw)

Many database systems provide sample databases with the product. A good intro to popular ones that includes discussion of samples available for other databases is Sample Databases for PostgreSQL and More (2006).

One trivial sample that PostgreSQL ships with is the Pgbench. This has the advantage of being built-in and supporting a scalable data generator.

-- Download file "pp-complete.csv", which has all records. -- If schema changes/field added, consult: https://www.gov.uk/guidance/about-the-price-paid-data

-- Create table: CREATE TABLE land_registry_price_paid_uk( transaction uuid, price numeric, transfer_date date, postcode text, property_type char(1), newly_built boolean, duration char(1), paon text, saon text, street text, locality text, city text, district text, county text, ppd_category_type char(1), record_status char(1));

-- Copy CSV data, with appropriate munging: COPY land_registry_price_paid_uk FROM '/path/to/pp-complete.csv' with (format csv, encoding 'win1252', header false, null '', quote '"', force_null (postcode, saon, paon, street, locality, city, district));