Performing operations on a table

You want to perform the following operations on a table using PostgreSQL:

1. Select index_id and make distinct query on the column_name column.

2. Return the highest index_id of each distinct column.

Which of these queries can help you do this?

Options

1.SELECT UNIQUE ON (column_name) index_id

FROM table_name

group by column_name, index_id desc;

2.SELECT UNIQUE ON (column_name) index_id

FROM table_name

order by column_name, index_id desc;

3.SELECT DISTINCT ON (column_name) index_id

FROM table_name

group by column_name, index_id desc;

4.SELECT DISTINCT ON (column_name) index_id

FROM table_name

order by column_name, index_id desc;

Related Posts

Close Bitnami banner
Bitnami