0
Whats wrong with sql statement?
I'm solving SQL problems and came across simple task which sound like: Get the first name,city and the total invoice of all the customers living neither in Paris, Prague, nor Rome and whose invoices are between $35 AND $38. This is is how my sql statement looks like: SELECT FirstName,City,InvoiceTotal FROM Customer WHERE Country IN ('Paris', 'Prague', 'Rome') OR InvoiceTotal Between 35 AND 38;
5 Respuestas
+ 6
Maybe because you confuse city with country?
+ 2
Did you mean "either or" or "neither nor"?
+ 1
This selects first name, city and total invoice for customers outside Paris, Prague and Rome, whose total invoices between $35 and $38:
SELECT FirstName, City, InvoiceTotal
FROM Customer
WHERE Country NOT IN ('Paris', 'Prague', 'Rome')
AND InvoiceTotal Between 35 AND 38;
Check if it was what you were after, good luck : )
0
Looks like he wants to get the FirstName, City and Invoice total when the Country is exactly Paris, Prague or Rome or when the Invoice total is between 35 and 38.
I guess we'd have to look at the records in your database to check if one of these two conditions have been met.
0
Try this
SELECT FirstName, City, InvoiceTotal
FROM Customer
WHERE City IN ('Paris', 'Prague', 'Rome')
AND InvoiceTotal Between 35 AND 38;