Download Simple Query Assignment and more Assignments Introduction to Database Management Systems in PDF only on Docsity!
Simple Query Assignment
Find the OrderDate and ShipperName from the order that was made by customer named Thomas Hardy. Query: SELECT Orders.OrderDate, Shippers.ShipperName FROM Orders JOIN Customers ON Orders.CustomerID = Customers.CustomerID JOIN Shippers ON Orders.ShipperID = Shippers.ShipperID WHERE Customers.ContactName = 'Thomas Hardy'; Result:
Get the employee born in January, sort by their name Query: SELECT FirstName, LastName, BirthDate FROM Employees WHERE MONTH(BirthDate) = 1 ORDER BY LastName, FirstName;
Result:
Number of product for each category Query: SELECT Categories.CategoryName, COUNT(Products.ProductID) FROM Categories JOIN Products ON Categories.CategoryID = Products.CategoryID GROUP BY Categories.CategoryName; Result: