Question: psql how to execute sql script?
Answer: For example, using psql, connect to the database and type the psql command at the database prompt. You can run SQL script files using the psql command-line option -f <SQL script filename>, where <SQL script filename> contains a series of SQL commands. Psql reads the file, runs the SQL commands, and exits.