Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Simple Query Assignment, Assignments of Introduction to Database Management Systems

Assignment of Database System in simple query

Typology: Assignments

2024/2025

Uploaded on 04/21/2025

framee2809
framee2809 🇮🇩

1 document

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

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: