programming-examples/sql/Union/8. Write a query to create a union of two queries that shows the names, cities, and ratings of all customers. Those with a rating of 300 or greater.sql
2019-11-18 14:05:53 +01:00

9 lines
454 B
SQL

/*8. Write a query to create a union of two queries that shows the names, cities, and ratings of all customers. Those with
a rating of 300 or greater will also have the words High Rating, while the others will have the words Low Rating.*/
SELECT customer_id, city, grade, 'High Rating'
FROM customer
WHERE grade >= 300
UNION
SELECT customer_id, city, grade, 'Low Rating'
FROM customer
WHERE grade < 300;