Skip to content
Advertisement

Code a SQL statement to change the type to “geeky” for any book that has the word “Computer” or “Networking” in the title

Code a SQL statement to change the type to “geeky” for any book that has the word “Computer” or “Networking” in the title

UPDATE book
      SET type = 'geeky'
WHERE title = %Computer% or %Networking%

The code isn’t right. What can I use in the WHERE clause to choose these two words and type them as geeky?

Advertisement

Answer

Try the following

UPDATE book
SET type = 'geeky'
WHERE title like '%Computer%' 
or 
title like '%Networking%'
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement