Assignment 5: Tour Operator Agency Database ✓ Solved

Assignment 5: Tour Operator Agency Database The Strayer

Write a three to four (3-4) page paper in which you propose an enhanced database management strategy. Your proposal should include the following:

  1. Design a data model that will conform to the following criteria:
    1. Propose an efficient data structure that may hold the tour operator’s data using a normalization process. Describe each step of the process that will enable you to have a 2nd Normal Form data structure.
    2. Create naming conventions for each entity and attributes.
    3. Conclude your data model design with an Entity Relationship Model (ERM) that will visually represent the relationships between the tables.
  2. Construct a query that can be used on a report for determining how many days the customer’s invoice will require payment if total amount due is within 45 days. Provide a copy of your working code as part of the paper.
  3. Using the salesperson table described in the summary above, complete the following:
    1. Construct a trigger that will increase the field that holds the total number of tours sold per salesperson by an increment of one (1).
    2. Create a query that can produce results that show the quantity of customers each salesperson has sold tours to.
  4. Support the reasoning behind using stored procedures within the database as an optimization process for the database transactions.

Paper For Above Instructions

Title: Enhanced Database Management Strategy for a Tour Operator Agency

The expansion of a multinational tour operator agency in the North American market presents a unique opportunity for enhanced data management to optimize operations. The existing data repository for the agency's reservation processing system is characterized by redundancy and a lack of normalization, which leads to inefficiencies in data handling and reporting. This paper proposes a comprehensive database management strategy aimed at addressing these issues through the design of a normalized database structure, the development of SQL queries, triggers, and stored procedures.

1. Proposed Data Model

The first step in enhancing the database is to establish an efficient data structure through normalization. The goal is to achieve at least Second Normal Form (2NF) to eliminate redundancy and improve data integrity.

1.1 Normalization Process

Normalization involves organizing data to minimize duplication. The following steps outline the normalization process to achieve 2NF:

  • First Normal Form (1NF): Ensure that each table has a primary key, and data is stored in a tabular format such that each column contains atomic values. For the tour operator agency, tables can be defined as:
  • Salespersons (employee_id, first_name, last_name, tours_sold)
  • Customers (customer_id, name, address, city, state, zip_code, total_amount_paid)
  • Tours (tour_id, tour_name, cost_per_person, date_effective)
  • Second Normal Form (2NF): Remove partial dependencies. Each non-key attribute should depend on the entire primary key. For instance, the 'total_amount_paid' is directly tied to 'customer_id' and 'tour_id'. Enhancements can include creating a junction table for 'Sales', linking customers with tours and salespersons.

1.2 Naming Conventions

Clear naming conventions enhance readability and maintenance. The proposed conventions include:

  • Salespersons: salesperson_id, first_name, last_name, tours_sold_count
  • Customers: customer_id, customer_name, customer_address, customer_city, customer_state, customer_zip, amount_due
  • Tours: tour_id, tour_title, cost_per_person, start_date, end_date
  • Sales: sale_id, customer_id, tour_id, salesperson_id, sale_date

1.3 Entity Relationship Model (ERM)

The ERM will visually represent how these entities interact with one another. While this model will be created using graphical software, it will include these relationships:

  • Salespersons and Sales (One-to-Many)
  • Customers and Sales (One-to-Many)
  • Tours and Sales (One-to-Many)

2. Payment Query

The following SQL query will determine how many days the customer’s invoice will require payment if the total amount due is within 45 days:

SELECT customer_id, DATEDIFF(DAY, GETDATE(), payment_due_date) AS days_to_payment

FROM invoices

WHERE total_amount_due

3. Salesperson Trigger and Query

3.1 Trigger Creation

The trigger will automatically update the number of tours sold for a salesperson whenever a sale is recorded:

CREATE TRIGGER update_tours_sold

ON Sales

AFTER INSERT

AS

BEGIN

UPDATE Salespersons

SET tours_sold_count = tours_sold_count + 1

WHERE salesperson_id IN (SELECT salesperson_id FROM inserted);

END;

3.2 Sales Query

This SQL query will aggregate the count of customers each salesperson has sold tours to:

SELECT s.salesperson_id, COUNT(DISTINCT sale.customer_id) AS customers_sold_to

FROM Sales s

JOIN Customers c ON s.customer_id = c.customer_id

GROUP BY s.salesperson_id;

4. Stored Procedures for Optimization

Stored procedures are an essential part of optimizing database transactions. They encapsulate complex operations into a single callable routine, promoting:

  • Performance: Processes often run faster when precompiled as a stored procedure.
  • Security: Access can be controlled at the stored procedure level.
  • Maintainability: Changes to the procedure can be made without affecting the applications using them.

Conclusion

The proposed database management strategy for the tour operator agency focuses on creating a normalized structure, which improves data integrity and reduces redundancy. Enhanced querying capabilities and the implementation of triggers and stored procedures will optimize data handling processes, allowing the agency to confidently forecast and project tour sales strategically.

References

  • Date, C. J. (2004). An Introduction to Database Systems. Pearson Education.
  • Elmasri, R., & Navathe, S. B. (2015). Fundamentals of Database Systems. Pearson.
  • Hernandez, M. J. (2013). Database Design for Mere Mortals: A Hands-On Guide to Relational Database Design. Addison-Wesley.
  • Kernighan, B. W., & Ritchie, D. M. (1988). The C Programming Language. Prentice Hall.
  • Rob, P., & Coronel, C. (2016). Database Systems: Design, Implementation, & Management. Cengage Learning.
  • Silberschatz, A., Korth, H. F., & Sudarshan, S. (2011). Database System Concepts. McGraw-Hill.
  • Welcher, W. (2017). SQL Cookbook. O'Reilly Media.
  • Abdullah, Z., & Ahmad, R. (2020). An Overview of Database Normalization. International Journal of Computer Applications.
  • Grady, P. K. (2019). Understanding Database Transactions with SQL. Springer.
  • Fehling, B., & Schubert, P. (2021). Microservices: Flexible Software Architecture. Springer.