Docsity

Simple Query Assignment, Assignments of Introduction to Database Management Systems

Toggle sidebar
bg1
Simple Query Assignment
1. 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:
2. 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;
pf3
pf4

Partial preview of the text

Download Simple Query Assignment and more Assignments Introduction to Database Management Systems in PDF only on Docsity!

Simple Query Assignment

  1. 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:
  2. 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:

  1. 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:

Result: