SQL beginner, need help with WHERE syntax error I am having a problem with a sql query that is supposed to find authors that have published at least one book priced $13 or more. IT is supposed to display first and last name, sorted by last name as long as the author has published at least one book priced $13 or more. Below is my query so far:

SELECT authors.au_fname, authors.au_lname, titles.price  
FROM authors, titles  ORDER BY au_lname ASC 
WHERE titles.price &gt; "13";


The first picture shows the db's first table authors and the second shows titles, which holds the price column.




What am I doing wrong? I cannot figure out what is wrong with my syntax.

Thanks!
Strings are denoted with Single Quotes.

WHERE titles.price &gt; '13'


If your price column is an int/decimal/float (or any numeric) datatype, you don't have to use a string.

WHERE titles.price &gt; 13


Probably better to use the second WHERE, as it is comparing the NUMERIC values, rather than the string values.  Even if the price column IS a string, it will CONVERT the value to a number in order to compare it against the 13.  It doesn't perform as well, but it is more accurate vs. comparing strings.

Also, your WHERE goes before your ORDER BY.

SELECT
FROM
JOIN
WHERE 
GROUP BY
HAVING
ORDER BY


Edit: the code below explains the difference between comparing numbers implicitly and comparing numbers as strings.  The commented WHERE clause yields different results due to the fact that it CONVERTS the price (StringNumber) column to a number before it compares it.  

WITH CTE_NumberStrings
AS
(SELECT '1' AS StringNumber
 UNION SELECT '2'
 UNION SELECT '3'
 UNION SELECT '12'
 UNION SELECT '23'
 )
 SELECT StringNumber 
 FROM CTE_NumberStrings
 WHERE StringNumber &gt; '13'
 --WHERE StringNumber &gt; 13