SQL script for Brian.