Topic 1 Question 95
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?
Select * from Sales where city_name ~ ‘$(San|El)*’;
Select * from Sales where city_name ~ ‘^(San|El)*’;
Select * from Sales where city_name ~’$(San&El)*’;
Select * from Sales where city_name ~ ‘^(San&El)*’;
ユーザの投票
コメント(6)
- 正解だと思う選択肢: B
Regex Patterns for everyone's reference
. : Matches any single character.
- : Matches zero or more of the preceding element.
- : Matches one or more of the preceding element. [abc] : Matches any of the enclosed characters. [^abc] : Matches any character not enclosed. ^ : Matches the start of a string. $ : Matches the end of a string. | : Logical OR operator. (abc) : Matches 'abc' and remembers the match.
Answer is B
👍 6chrispchrisp2024/07/23 - 正解だと思う選択肢: B
^ asserts the position at the start of the string. (San|El) matches either "San" or "El".
👍 3JohnYang2024/06/18 - 正解だと思う選択肢: B
~: This operator indicates the use of a regular expression. ^: This symbol signifies the start of the string. (San|El): This pattern matches strings that start with either "San" or "El".
👍 2tgv2024/06/15
シャッフルモード