SQL Solution
SQL Solution
---
2. **Retrieve the names of all products priced between 200 and 500.**
SELECT ProductName
FROM Product
WHERE Price BETWEEN 200 AND 500;
2. **Retrieve the `CustomerName` and `LoyaltyPoints` for customers aged between 25 and 40.**
4. **Update the `LoyaltyPoints` by adding 100 points for all customers aged 30 and above.**
UPDATE Customer
SET LoyaltyPoints = LoyaltyPoints + 100
WHERE Age >= 30;
FROM Sales
GROUP BY ProductID;
FROM Sales
SELECT *
FROM Sales
FROM Sales
GROUP BY ProductID;
Here are the SQL answers for each question based on the provided `Supplier` table:
SELECT *
FROM Supplier
FROM Supplier
GROUP BY City;
SELECT SupplierName
FROM Supplier
4. **Update the `ContactNumber` for the supplier with `SupplierID` 103 to "555-9999".**
UPDATE Supplier
5. **Delete suppliers from cities where there are more than one supplier.**
WHERE City IN (
SELECT City
FROM Supplier
GROUP BY City
);
Here are the SQL answers for each question based on the provided `Employee` table:
UPDATE Employee
3. **Retrieve names of employees who earn more than 60000 and are in the `IT` department.**
SELECT Name
FROM Employee
4. **Display the `Department` and the total `Salary` paid to employees in each department.**
FROM Employee
GROUP BY Department