0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

文字列の1文字目が母音である列を取得するクエリー

Last updated at Posted at 2017-05-03

元ネタ

方法1

IN演算子とSUBSTRING関数を使用する

SELECT DISTINCT city
FROM station
WHERE SUBSTRING(city, 1, 1) IN ("a", "e", "i", "u", "o")
;

方法2

REGEXP文字列正規表現演算子を使用する

SELECT DISTINCT city
FROM station
WHERE city REGEXP "^[aiueo]"
;

参考

12.3.2 比較関数と演算子
https://dev.mysql.com/doc/refman/5.6/ja/comparison-operators.html#function_in
12.5 文字列関数
https://dev.mysql.com/doc/refman/5.6/ja/string-functions.html
12.5.2 正規表現
https://dev.mysql.com/doc/refman/5.6/ja/regexp.html

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?