0% found this document useful (0 votes)
2 views2 pages

Dbms Assignment

The document contains SQL queries for various customer and product data retrieval tasks. It includes queries to find customers from specific countries, products within a price range, and aggregate functions like counting customers and summing payments. Additionally, it provides queries to find the cheapest and most expensive products, as well as average product prices and order statuses for a specific year.

Uploaded by

sonali.s
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Dbms Assignment

The document contains SQL queries for various customer and product data retrieval tasks. It includes queries to find customers from specific countries, products within a price range, and aggregate functions like counting customers and summing payments. Additionally, it provides queries to find the cheapest and most expensive products, as well as average product prices and order statuses for a specific year.

Uploaded by

sonali.s
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Q1. Find all customers from India.

SELECT * FROM customer WHERE country="India";

Q2. Find all customers from either 'India' OR 'USA'.

SELECT * FROM customer WHERE COUNTRY IN ("India" , "USA");

SELECT * FROM customer WHERE COUNTRY ="India" OR country= "USA";

Q3. Get all customers whose city name starts with 'New'.

SELECT * FROM customer WHERE

city LIKE "NEW%";

Q4. Get all products with a price between 500 and 2000.

SELECT * FROM product WHERE

Price BETWEEN 500 and 2000;

Q5. Count the total number of customers.

SELECT COUNT(*) FROM customer;

Q6. Find the cheapest product and its price.

SELECT ProductName,price FROM product

ORDER BY Price ASC LIMIT 1;

Q7. Find the most expensive product and its price.

SELECT ProductName,price FROM product

ORDER BY Price desc LIMIT 1;


.8 Find the average product price.

SELECT AVG(Price) FROM product;

Q9. Find the total sales amount (sum of payments).

SELECT SUM(amount) FROM payment;

Q10. Find all orders placed in 2025 that are either 'Pending' OR 'Shipped'.

SELECT * FROM ORDERS WHERE

OrderDate=2025 AND STATUS ='Pending' OR STATUS ='Shipped';

You might also like