0% found this document useful (0 votes)
2 views

Databases_quiz

The document outlines a database design for TechServe Ltd, detailing tables for Customers, Orders, Inventory, and Payments, along with their respective fields. It includes tasks related to table relationships, queries for revenue and customer payments, form design for customer data entry, report generation for high-value orders, and automation using macros. Additionally, it emphasizes the importance of referential integrity and includes specific query requirements for managing inventory and order balances.

Uploaded by

levi makokha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Databases_quiz

The document outlines a database design for TechServe Ltd, detailing tables for Customers, Orders, Inventory, and Payments, along with their respective fields. It includes tasks related to table relationships, queries for revenue and customer payments, form design for customer data entry, report generation for high-value orders, and automation using macros. Additionally, it emphasizes the importance of referential integrity and includes specific query requirements for managing inventory and order balances.

Uploaded by

levi makokha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Databases

Database Question (Total: 30 Marks)


You are tasked with designing and managing a database for "TechServe Ltd," a
company that tracks customer orders, payments, and inventory. The database
contains the following tables:
1. Customers
o CustomerID (Primary Key)
o FirstName
o LastName
o Email
o Phone
2. Orders
o OrderID (Primary Key)
o CustomerID (Foreign Key)
o OrderDate
o TotalAmount
3. Inventory
o ProductID (Primary Key)
o ProductName
o QuantityInStock
o PricePerUnit
4. Payments
o PaymentID (Primary Key)
o OrderID (Foreign Key)
o PaymentDate
o AmountPaid
Tasks
Section A: Table Relationships (5 Marks)
a) Identify and define the relationships between the tables. Justify your choices.
(3 marks)
b) Enforce referential integrity in your relationships. Explain the importance of this
step in database management.
(2 marks)

Section B: Queries (10 Marks)


a) Write a query to calculate the total revenue from all orders. Use an
aggregate function and name your query "TotalRevenueQuery."
(2 marks)
b) Create a query to list all customers who have made payments between 1st
January 2024 and 31st December 2024. Display their FirstName, LastName, and
AmountPaid. Name your query "CustomerPaymentQuery."
(3 marks)
c) Write a query to identify products with less than 10 units in stock. Include
ProductName and QuantityInStock. Name your query "LowStockQuery."
(2 marks)
d) Write a query to calculate the remaining balance for each order, assuming
all payments made are recorded in the database. Use a calculated field
named "BalanceDue." Name your query "BalanceDueQuery."
(3 marks)

Section C: Forms and Reports (7 Marks)


a) Design a form for entering new customer data into the Customers table.
Highlight two essential validation rules you would implement in this form.
(3 marks)
b) Generate a report showing all orders with a TotalAmount greater than $500,
grouped by CustomerID. Include calculated totals for each group and overall
totals at the end. Name your report "HighValueOrders."
(4 marks)

Section D: Advanced Functions and Macros (8 Marks)


a) Use a macro to automate the following task: Whenever a new payment is
entered into the Payments table, check if the AmountPaid equals the
TotalAmount for the corresponding order. If it does, update the status of that
order to "Paid" in the Orders table. Explain how you would create and use this
macro.
(5 marks)
b) Write an IIf function to display "Low Stock" if QuantityInStock is less than 10 and
"In Stock" otherwise, in a calculated field within a query.
(3 marks)

You might also like