Professional Documents
Culture Documents
Lab8 Guide
Lab8 Guide
The Blood Donation Management System (BDMS) is a comprehensive database designed to manage
the process of blood donation and distribution efficiently.
Entities:
Donor: Captures detailed information about donors, including their DonorID, Name, Contact
Information, Blood Type, and Donation History.
Blood Bank: Contains details about the various blood banks and centers participating in the
donation process. Attributes include BankID, Name, Address, and Contact Information.
Blood Type: Represents the different blood types available for donation. Attributes include
TypeID and BloodType.
Donation Event: Captures information about specific donation events organized by blood
banks. Attributes include EventID, Date, Location, and Blood Bank involved.
Blood Donation: Central entity that tracks individual donations made by donors. Attributes
include DonationID, DonorID, BankID, DonationDate, and Quantity.
Blood Component: Contains details about the various components of blood, such as red
blood cells, platelets, and plasma. Attributes include ComponentID, ComponentName, and
Blood Type.
Blood Collection: Records information about the collection process, including CollectionID,
CollectionDate, and CollectionSite.
Blood Screening: Tracks details about the screening process, including ScreeningID,
ScreeningDate, and ScreeningResult.
Blood Storage: Stores information about blood storage, including StorageID, StorageLocation,
and ExpiryDate.
Relationships:
Donor to Blood Donation: A donor can make multiple donations over time.
Blood Bank to Donation Event: A blood bank organizes multiple donation events.
Blood Bank to Blood Donation: A blood bank receives donations from multiple donors.
Blood Donation to Blood Type: Each donation is associated with a specific blood type.
Blood Donation to Blood Component: A donation can be divided into multiple blood
components.
Blood Donation to Blood Screening: Each donation undergoes a screening process.
Blood Donation to Blood Storage: Donated blood is stored for future use.
This comprehensive ERD allows for detailed tracking and management of the blood donation
process, from the initial donation event to the final storage and distribution of blood and its
components.
Display a list of categories along with the count of products in each category.
SELECT c.CustomerName
FROM Customers c
JOIN Orders o ON c.CustomerID = o.CustomerID
GROUP BY c.CustomerName
HAVING COUNT(DISTINCT o.EmployeeID) > 1;
Retrieve the total quantity of each product sold in a specific month.
DECLARE @Month INT = 08;
DECLARE @Year INT = 1996;
SELECT p.ProductName
FROM Products p
LEFT JOIN (
SELECT ProductID, SUM(Quantity) AS TotalQuantitySold
FROM OrderDetails
GROUP BY ProductID
) AS Sold ON p.ProductID = Sold.ProductID
WHERE COALESCE(Sold.TotalQuantitySold, 0) < 10;
Show the number of orders placed by each employee.