May 2019
Intermediate to advanced
600 pages
20h 46m
English
The USING clause can also be used to handle complex expressions involving other columns. This could be used for data transformations, which might be useful for DBAs in some circumstances, such as migrating to a new database design on a production database server. Let's put everything together in a full, working example. We will start with this table that has to be transformed:
postgres=# select * from cust; customerid | firstname | lastname | age ------------+-----------+----------+----- 1 | Philip | Marlowe | 38 2 | Richard | Hannay | 42 3 | Holly | Martins | 25 4 | Harry | Palmer | 36(4 rows)
We want to transform it into a table design like the following:
postgres=# select * from cust; customerid | custname | age ------------+----------------+----- ...
Read now
Unlock full access