Reference: SELECT
-- Get all info about a specific movie
select * from movies where id = 42;
-- Selecting specific columns is more robust against schema changes and reduces I/O
select name, length from movies where id = 42;For fast single-element access with
where, consider specifying id as primary key or adding an explicit index.You can also use expressions or functions to transform your data:
select date_trunc('month', release_date) from movies;For many data-specific operations, executing them in the database can be more efficient.