Lets say I have a table with the following columns:
- first_name
- last_name
- height
- social_security_number
- phone_number
Let's say I very often fetch first_name, last_name, and height together when I'm fetching public data, so I want to bundle them together
Similarly, I want to bundle social_security_number and phone_number as private data.
In order to simplify my queries and not make a mistake in the future, I want to create some sort of a multi-column reference that will serve as an alias to public and private data, so:
I want to do something like this:
(made up syntax)
ALTER TABLE acc CREATE BUNDLE first_name, last_name, height AS public_acc_columns;
ALTER TABLE acc CREATE BUNDLE social_security_number, phone_number AS private_acc_columns;
And then use it like this
-- returns first_name, last_name, height
SELECT public_acc_columns FROM acc;
-- returns social_security, phone_number
SELECT private_acc_columns FROM acc;
-- returns all columns
SELECT public_acc_columns, private_acc_columns FROM acc;