Complete the code to declare an integer array column named scores.
CREATE TABLE test_scores (id SERIAL PRIMARY KEY, scores [1]);In PostgreSQL, to declare an array column of integers, use INTEGER[].
Complete the code to insert an array of integers into the scores column.
INSERT INTO test_scores (scores) VALUES ([1]);PostgreSQL uses ARRAY[...] syntax to insert arrays explicitly.
Fix the error in the query to select the second element of the scores array.
SELECT scores[1] FROM test_scores;In PostgreSQL, array elements are accessed using square brackets with 1-based indexing.
Fill both blanks to update the third element of the scores array to 10.
UPDATE test_scores SET scores[1] = [2] WHERE id = 1;
Use square brackets to specify the element index and assign the new integer value without quotes.
Fill all three blanks to select rows where the scores array contains the value 5.
SELECT * FROM test_scores WHERE [1] = ANY([2]) AND [3] = 5;
The ANY operator checks if the value (5) is present in the array column (scores).