PostgreSQL dump of a database that can map postcodes to parliamentary constituencies.
+-----------+--------------------------+
| id | name |
+-----------+--------------------------+
| E14000530 | Aldershot |
| E14000531 | Aldridge-Brownhills |
| E14000532 | Altrincham and Sale West |
| E14000533 | Amber Valley |
| E14000534 | Arundel and South Downs |
+-----------+--------------------------+
+----------+-----------------+
| postcode | constituency_id |
+----------+-----------------+
| AB10AA | S14000002 |
| AB10AB | S14000002 |
| AB10AD | S14000002 |
| AB10AE | S14000058 |
+----------+-----------------+
Tested with PostgreSQL 13.
git clone \
--depth 1 \
https://github.com/MatthewAtHull/postcode-constituency-sql.git
cd postcode-constituency-sql
psql dbname -f dump.sql
SELECT constituency.name
FROM postcode
INNER JOIN constituency
ON constituency.id = postcode.constituency_id
WHERE postcode.postcode = 'HU67TS';
- National Statistics Postcode Lookup (February 2021) (Custom License)
- Westminster Parliamentary Constituencies (December 2020) (Custom License)