Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
2) Get customer id, first name, last name, city , country and mobile of a customer who belongs to
Sweden.
5) Modify the table to specify that products whose price is more than 50 are discontinued.
6) Write a query to specify that product with product id PA000112 is no more continued.
UPDATE `products` SET is_discontinued=1 WHERE prod_id=’ PA000112’
7) Modify the city and mobile number to Oslo and (0)1-953530 of the supplier who has id
SUPL8744.
Same as 4)
9) Get company name, contact name, city and country of suppliers and list them in order of company
name.
10) Get company name, contact name, city and country of suppliers and list them in descending order of
company name
12) Write a query to fetch supplier id, company name, city and country where country is USA, Japan or
Germany and list them in ascending order of country and descending order of company name.
13) Write a query to get order details and list them in ascending order of their year and descending
order of total amount.
15) Write a query to get details of products other than the first 4 having highest unit price.
SELECT * FROM `products` WHERE unit_price NOT IN (SELECT * FROM (SELECT unit_price FROM
`products` ORDER BY unit_price DESC LIMIT 4)abc);
16) Write a query to get details of all products except the first 5 having highest unit price.
SELECT * FROM `products` WHERE unit_price NOT IN (SELECT * FROM (SELECT unit_price FROM
`products` ORDER BY unit_price DESC LIMIT 5)abc);
SELECT country FROM (SELECT DISTINCT country FROM customer UNION SELECT DISTINCT country
FROM suppliers)abc ORDER BY country;
18) Write a query to get total number of unique countries.
SELECT COUNT(DISTINCT country) AS TOTAl_COUNTRIES FROM (SELECT country FROM customer UNION
SELECT country FROM suppliers)abc;
AND:-
OR:-
SELECT * FROM `customer` WHERE NOT city = 'New York' AND NOT city='Berlin';
29) Get all customers who have placed an order with order details.
32) Get details of customer with total amount spent in descending order. Concatenate first
name and last name in result.