Skip to content

SQL Practice 2

1. 문제 [[object Object]]

다음 환자 테이블에서 first_name이 'C'로 시작하는 환자의 first_name을 표시하시오.

patient_idfirst_namelast_namegenderbirth_datecityprovince_idallergiesheightweight
1DonaldWaterfieldM1963-02-12BarrieONNULL15665
2MickeyBaashaM1981-05-28DundasONSulfa18576
3JijiSharmaM1957-09-05HamiltonONPenicillin194106
4BlairDiazM1967-01-07HamiltonONNULL191104
5CharlesWolfeM2017-11-19OrilliaONPenicillin4710
6SueFalconF2017-09-30AjaxONPenicillin435

2. 정답

SELECT
  first_name
FROM
  patients
WHERE
  first_name LIKE 'C%'

3. 다른 정답

SELECT first_name
FROM patients
WHERE substring(first_name, 1, 1) = 'C'

3. 결과

first_name
Charles