-- Select all employees from the 'Employees' table
SELECT * FROM Employees;
-- Retrieve names and salaries of employees earning over $50,000
SELECT Name, Salary FROM Employees WHERE Salary > 50000;
-- Retrieve orders placed by 'CustomerID' 123
SELECT * FROM Orders WHERE CustomerID = 123;
-- Calculate the total sales amount for each product category
SELECT Category, SUM(Price) AS TotalSales FROM Products GROUP BY Category;
-- Retrieve customer names and their corresponding orders
SELECT Customers.Name, Orders.OrderID
FROM Customers
INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID;
-- Find employees with the highest salary
SELECT Name FROM Employees WHERE Salary = (SELECT MAX(Salary) FROM Employees);
-- Insert orders for products with low stock
INSERT INTO OrderQueue (ProductID, Quantity)
SELECT ProductID, 10 FROM Products WHERE Stock < 20;
-- Update employee salaries by 10% for those in the 'Sales' department
UPDATE Employees
SET Salary = Salary * 1.1
WHERE Department = 'Sales';
-- Delete orders placed by customers who have not made a purchase in the last year
DELETE FROM Orders WHERE CustomerID IN (SELECT CustomerID FROM Customers WHERE LastPurchaseDate < DATEADD(year, -1, GETDATE()));