- μ κ·ννμμ΄λ?
: λ¬Έμμ΄μμ ν¨ν΄μ μ°Ύμλ΄λ μΌμ’ μ κ·μΉ
-> μ€μ λ‘ μ κ·ννμμ λ€ μκ³ μ°λ μ¬λμ κ±°μ μμ.(κ²μμ ν΄μ μ°λ κ²½μ°κ° λλΆλΆ)
-> μ κ·ννμμ΄ μ΄λ°κ±°κ΅¬λ νλ μ΄ν΄μ νν λ¦¬μΌ μ¬μ΄νΈμμ μ‘°κΈ μ°μ΅μ ν΄λ³Έ νμ κ·Έ λ€μλΆν°λ νμν λλ§λ€ κ²μμ ν΄μ μ°ΎμμΈ μ μλ μ λλ‘ νμ΅ν κ².
1. λ¬Έμ
Query the list of CITY names starting with vowels (i.e., a, e, i, o, or u) from STATION. Your result cannot contain duplicates.
where LAT_N is the northern latitude and LONG_W is the western longitude.
-> STATION ν μ΄λΈμμ CITYκ° λͺ¨μμΌλ‘ μμνλ κ²λ€λ§ λ½μμλΌ(μ€λ³΅ νμ©x)
2. λ΄νμ΄
<κΈ°μ‘΄ νμ΄>
SELECT DISTINCT CITY
FROM STATION
WHERE city LIKE 'a%'
OR city LIKE 'e%'
OR city LIKE 'i%'
OR city LIKE 'o%'
OR city LIKE 'u%'
Q : νμ΄μ A, E, I, O, Uλ₯Ό κ°μ΄ μ¨μ€ μ μλ λ°©λ²μ΄ μλ?
A : μ κ·ννμ μ¬μ©
-> λ¬Έμμ΄μμ νΉμ ν¨ν΄μ μ°Ύμμ ex) λͺ¨μμΌλ‘ μμνμ§ λ§κ², μμμΌλ‘ μμνμ§ λ§κ², κ°μ§κ³ μλ λ¬Έμμ΄μ μ«μκ° 3κ°λ λ€μ΄κ°μΌν¨, μ΄λ©μΌ ν¨ν΄μ μ°Ύμλ¬λΌ λ±λ± λ¬Έμμ΄μμ νΉμ ν¨ν΄μ μ°Ύμλ΄λλ° μ°μ΄λ κ²μ μ κ·ννμμ΄λΌκ³ ν¨.
<μ κ·ννμ μ¬μ© νμ΄>
- μ κ·ννμ : regular expression μ€μ¬μ REGEXP
- NOT REGEXP μ΅μ μ ~λ‘ μμνκ±°λ λλμ§ μμμ μλ―Έ!
- REGEXP 'κΈ°νΈ'
- ^[aeiou] : aeiouλ‘ μμ(νΉμ λ¬Έμμ΄λ‘ μμ)
- [aeiou]$ : aeiouλ‘ λλ¨(νΉμ λ¬Έμμ΄λ‘ λλ¨)
- .* : κ·Έ λ€μλ μ΄λ€ λ¬Έμμ΄μ΄ μλ μκ΄μμ("." : μ무 κΈμλ μλ λ¨ + "*" : κΈμμμ μ νμ μμ)
SELECT DISTINCT city
FROM station
WHERE city REGEXP '^[aeiou].*'
3. κ²°κ³Ό
* REGEXP μ°μ΅ν μ μλ νν 리μΌμ¬μ΄νΈ
RegexOne - Learn Regular Expressions - Lesson 1: An Introduction, and the ABCs
Regular expressions are extremely useful in extracting information from text such as code, log files, spreadsheets, or even documents. And while there is a lot of theory behind formal languages, the following lessons and examples will explore the more prac
regexone.com
- μ€λ₯Έμͺ½μ Lesson Notesκ° νμν μ κ·ννμ.
- μ°μ΅ν΄λ³Όκ²!
- λ¬Έμλ₯Ό μ§μ μ λ ₯νκ³ μ κ·ννμμ μ μ©ν΄λ³Ό μ μλ μ¬μ΄νΈ
RegExr: Learn, Build, & Test RegEx
RegExr is an online tool to learn, build, & test Regular Expressions (RegEx / RegExp).
regexr.com
- μ΄λ κ² "Arligton"μ΄λΌλ λ°μ΄ν°κ° μμ λ μ κ·ννμμΌλ‘ μ΄λ»κ² μΆμΆν΄μ¬μ§ μ μ©ν΄λ³Ό μ μκ³ νλ¨μ μ κ·ννμμ λν μ€λͺ λ μμΌλ 곡λΆν λ λμμ΄ λ κ²!
- μ¬μ€ SQLμμλ λμλ¬Έμ ꡬλΆμ΄ μμ΄μ ^[aeiou].*μΌλ‘ μ¨μ€λ λμ§λ§ νμ΄μ¬μ΄λ λ€λ₯Έ μΈμ΄μμλ λμλ¬Έμκ° κ΅¬λΆλκΈ° λλ¬Έμ μ¬κΈ°μλ μ¨μ£Όμλ€.
'π¬ MySQL > λ¬Έμ νμ΄' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[MySQL] ν΄μ»€λν¬ μλΈμΏΌλ¦¬ μ°μ΅ (Top Earners) (0) | 2023.01.25 |
---|---|
[MySQL] λ°μ΄ν°λΆμμ μν SQL (μλΈμΏΌλ¦¬) (0) | 2023.01.25 |
[MySQL] ν΄μ»€λν¬ μ§κ³ν¨μ μ°μ΅ (Weather Observation Station 4) (0) | 2023.01.25 |
[MySQL] ν΄μ»€λν¬ μ§κ³ν¨μ μ°μ΅ (Population Density Difference) (0) | 2023.01.25 |
[MySQL] ν΄μ»€λν¬ μ§κ³ν¨μ μ°μ΅ (Average Population) (0) | 2023.01.25 |