Write an SQL Query
Write an SQL Query
2. Write an SQL query to find all products that are not monitors.
3. Write an SQL query to find all products that are either keyboards or mouse.
4. Write an SQL query to find all products whose names end with the letter 'r'.
5. Write an SQL query to find all orders where the total price is greater than 100.
Find the out of the following
6. SELECT * FROM Products WHERE Price BETWEEN 20 AND 200;
7. SELECT COUNT(*) AS TotalProducts FROM Products;
SQL 2
1. Write a query to list the cars whose make starts with 'B'.
2. Write a query to find all cars from the year 2020 or newer.
3. Write a query to list all cars that are either a 'Toyota' or a 'Honda'.
4. Write a query to update the sale price of the sale with SaleID = 1 to $24,000.
5. Write a query to count the number of sales for each car make.
******* Find the output of following******
6. SELECT c.Make, AVG(s.SalePrice) AS AverageSalePrice FROM Cars c, Sales s WHERE c.CarID =
s.CarID GROUP BY c.Make;
7. SELECT Make, Model, Year, Price FROM Cars WHERE Model LIKE '%Class%’;
SQL 3
1. Write a query to list the names of students whose last name starts with 'S'.
2. Write a query to order students by last name in descending order.
3. Write a query to delete a student whose student ID is 3.
4. Write a query to select students older than 21.
5. Write a query to select students aged between 20 and 22.
****Find the output of the following*****
6. SELECT * FROM Student WHERE LastName NOT LIKE '%o%';
7. UPDATE Student SET Age = 23 WHERE FirstName = 'Emma' AND LastName = 'Watson';
SQL 5
1. To display all the details of those watches whose name ends with ‘Time’
2. To display watch’s name and price of those watches which have price range in between 5000-15000.
3. To display total quantity in store of Unisex type watches.
4. To display watch name and their quantity sold in first quarter.
5. Write a query to display the maximum price and minimum quantity in store from the Watches table.
****Find the output of the following*****
6. SELECT quarter, sum(qty_sold) FROM sale GROUP BY quarter;
7. SELECT watch_name, qty_store, SUM(qty_sold), qty_store-SUM(qty_sold) AS STOCK FROM watches w, sale s
WHERE w.watchid=s.watchid GROUP BY s.watchid;