Complete the code to create a hash index on the column 'email' in the 'users' table.
CREATE INDEX idx_users_email ON users USING [1] (email);The hash index type is used for equality comparisons in PostgreSQL.
Complete the query to find users with email exactly 'user@example.com' using the hash index.
SELECT * FROM users WHERE email [1] 'user@example.com';
The equality operator = is used to match exact values, which works efficiently with hash indexes.
Fix the error in the index creation statement to use a hash index on the 'username' column.
CREATE INDEX idx_users_username ON users USING [1] (username);To create a hash index, the hash keyword must be used after USING.
Fill both blanks to create a hash index on the 'phone' column in the 'contacts' table.
CREATE INDEX [1] ON contacts USING [2] (phone);
The index name should be descriptive, like idx_contacts_phone_hash, and the index type for equality is hash.
Fill all three blanks to create a hash index on the 'zipcode' column and query it for exact match '12345'.
CREATE INDEX [1] ON addresses USING [2] (zipcode); SELECT * FROM addresses WHERE zipcode [3] '12345';
The index name is descriptive, the index type is hash, and the equality operator = is used for exact matching.