The WHERE keyword enables you to narrow down queries by returning only those where a certain expression is true.
SELECT author,title FROM classics WHERE author="Mark Twain"; SELECT author,title FROM classics WHERE isbn="9781598184891 ";
Using Like to match patterns
You can also do pattern matching for your searches using the LIKE qualifier, which allows searches on parts of strings. This qualifier should be used with a % character before or after some text. When placed before a keyword, % means “anything before” and after a keyword it means “anything after”.
SELECT author,title FROM classics WHERE author LIKE "Charles%"; SELECT author,title FROM classics WHERE title LIKE "%Species"; SELECT author,title FROM classics WHERE title LIKE "%and%";
The first command outputs the publications by both Charles Darwin and Charles Dickens because the LIKE qualifier was set to return anything matching the string Charles followed by any other text. Then just The Origin of Species is returned, because it’s the only row whose column ends with the string Species. Lastly both Pride and Prejudice and Romeo and Juliet are returned, because they both matched the string and anywhere in the column. The % will also match if there is nothing in the position it occupies; in other words, it can match an empty string.