
Explanation:
In Amazon Redshift, the ~ operator performs POSIX regular expression matching. The pattern '^(San|El)' correctly uses ^ to anchor the match at the start of the string, and (San|El) with the | (OR) operator to match either prefix. Options A and C use incorrect syntax ( anchor), and Option D incorrectly uses & instead of | for the OR condition.
Ultimate access to all questions.
Question 27.
A company has a data warehouse that contains a table that is named Sales. The company stores the table in Amazon Redshift. The table includes a column that is named city_name. The company wants to query the table to find all rows that have a city_name that starts with "San" or "El." Which SQL query will meet this requirement?
A
Select * from Sales where city_name ~ "${San|El}";
B
Select * from Sales where city_name ~ '^(San|El)';
C
Select * from Sales where city_name ~ '$(San&El)';
D
Select * from Sales where city_name ~ '^(San&El)';
No comments yet.