나는 이렇게 학습한다/Algorithm & SQL

BASICS: Length based SELECT with LIKE

daco2020 2022. 6. 8. 23:35
반응형

You will need to create SELECT statement in conjunction with LIKE.

Please list people which have first_name with at least 6 character long

names table schema

  • id
  • first_name
  • last_name

results table schema

  • first_name
  • last_name

 

 

Solution:

SELECT 
  first_name, 
  last_name 
FROM 
  names 
WHERE 
  first_name LIKE '______%'
  • Percent Sign (%): represents zero or more unspecified characters
  • Under Score(_) : Represents 1 unspecified character

 

 

Result:

first_name last_name
Aundrea Crona
Jonathan Corkery
Rodney Bernhard
Fidelia Reilly
Savanna Kuvalis
Sandie Bernhard

 

 

 

 

반응형