SELECT names

From SQLZOO
Revision as of 20:52, 20 November 2014 by Cs66 (talk | contribs)
Jump to: navigation, search
namecontinent
AfghanistanAsia
AlbaniaEurope
AlgeriaAfrica
AndorraEurope
AngolaAfrica
....

Pattern Matching Strings

This tutorial uses the LIKE operator to check names. We will be using the SELECT command on the table world:

Summary

You can use WHERE name LIKE 'B%' finds those countries that start with "B".

  • The % is a wild-card it can match any characters

Find the country that start with Y

SELECT name FROM world
  WHERE name LIKE 'F%'
SELECT name FROM world
  WHERE name LIKE 'Y%'