Complete the code to create a composite type named 'person'.
CREATE TYPE person [1] (name text, age integer);The CREATE TYPE statement uses AS to define the structure of the composite type.
Complete the code to insert a value into a table with a composite type column.
INSERT INTO employees (info) VALUES (ROW('Alice', [1]));
The ROW constructor needs the age as an integer without quotes.
Fix the error in the SELECT statement to access the 'name' field of the composite type column 'info'.
SELECT info[1]name FROM employees;:: instead of field access.Use the dot . operator to access fields of a composite type in PostgreSQL.
Fill both blanks to create a composite type and use it in a table.
CREATE TYPE address AS (street [1], city [2]); CREATE TABLE locations (id serial PRIMARY KEY, addr address);
Both fields 'street' and 'city' should be of type text in the composite type.
Fill all three blanks to select the 'city' from the 'addr' composite column and filter by 'street'.
SELECT addr[1]city FROM locations WHERE addr[2]street = [3]'Main St';
Use the dot operator to access composite fields and single quotes for string literals.