In Oracle:
create or replace type tr_del as object (row_id varchar2(18), pk_id number);
select tr_del(last_name, employee_id)
from employees where
department_id=30;
output:
(Raphaely, 114)
(Khoo, 115)
(Baida, 116)
How can I achieve the same in PostgreSQL?
Best Answer
Although the syntax is different, you can achieve exactly what you want.
You can create type by using the script below;
Then your table structure should look like this;
After that you can use it in the query like this;
Fiddle is here
You may want to read Composite Types section.