May 2019
Intermediate to advanced
600 pages
20h 46m
English
As an example, we will create a script that does some work on a given table. We will keep it simple, because we just want to show how variables work.
For instance, we might want to add a text column to a table, and then set it to a given value. So, we write the following lines into a file called vartest.sql:
ALTER TABLE mytable ADD COLUMN mycol text;UPDATE mytable SET mycol = 'myval';
The script can be run as follows:
psql -f vartest.sql
Read now
Unlock full access