Exam No. 1: 50-Minute Class With 3 Questions ✓ Solved

Exam No 1 In Class 50 Minutes 30 3 Questions In Total Your Nam

Given the scenario of a cosmetic product retailer needing to create a database, the company must track information related to products, customers, orders, and warehouses. The scenario includes details about products (product ID, name, description, unit price), customers (names, shipping addresses, email addresses, accounts), orders (order date, invoice number, products purchased with quantities), and warehouses (name, address, manager, telephone). Tasks include creating an Entity-Relationship (E/R) model with appropriate entities, attributes, keys, relationships, and cardinalities; and converting this E/R model into a normalized database design in tables. Additionally, the scenario involves understanding multivalued attributes, functional dependencies, and normalization processes, including handling anomalies and enforcing data integrity, especially in contexts with multiple phone numbers per employee and dependencies within inventory data.

Sample Paper For Above instruction

Entity-Relationship (E/R) Model for the Retailer Database

In designing the database for the cosmetic product retailer, the initial step involves identifying the main entities along with their attributes, primary keys, and relationships. The key entities include Product, Customer, Order, Warehouse, and Purchase (to capture the many-to-many relationship between orders and products).

Entities and Attributes

  • Product: ProductID (PK), ProductName, Description, UnitPrice
  • Customer: CustomerID (PK), CustomerName, ShippingAddress, Email
  • Order: OrderID (PK), OrderDate, InvoiceNumber, CustomerID (FK)
  • Warehouse: WarehouseID (PK), WarehouseName, WarehouseAddress, Manager, Telephone
  • Purchase: PurchaseID (PK), OrderID (FK), ProductID (FK), Quantity

Relationships and Cardinalities

  • Customer — Places — Order: One customer can place many orders (1:N), but each order is placed by one customer (N:1).
  • Order — Contains — Purchase — Includes — Product: An order includes multiple products (M:N). The Purchase entity resolves the M:N relationship, with each purchase record linked to one order and one product. The cardinality is many-to-one from Purchase to Order and Product.
  • Product — Stored in — Warehouse: Products are stocked in multiple warehouses; the relationship can be represented with a linking entity or directly if each product is stored in multiple warehouses (M:N). For simplicity, a relationship WarehouseStocked with cardinalities indicates many-to-many, possibly with additional attributes like stock quantity.

Diagram Highlights

The ER diagram would show entities with primary keys, attributes, and relationships with their respective cardinalities labeled as minimum and maximum (e.g., 1..N).

Conversion to Normalized Tables

Transforming the ER model into tables involves creating relational schemas that are in at least Third Normal Form (3NF). Tables include:

Products

ProductID (PK)ProductNameDescriptionUnitPrice

Customers

CustomerID (PK)CustomerNameShippingAddressEmail

Orders

OrderID (PK)OrderDateInvoiceNumberCustomerID (FK)

Warehouses

WarehouseID (PK)WarehouseNameAddressManagerTelephone

Purchase

PurchaseID (PK)OrderID (FK)ProductID (FK)Quantity

WarehouseStocked (Optional, to manage stock in multiple warehouses)

WarehouseID (FK)ProductID (FK)StockQuantity

Handling Multivalued Attributes and Dependencies

For employees with multiple phone numbers, a separate table EmployeePhone (EmployeeID, PhoneNo), with EmployeeID as FK, can be created to maintain multivalued attributes. The primary key might be composite (EmployeeID, PhoneNo).

The functional dependencies such as ProductID, WarehouseID → Quantity-in-Stock, and ProductID → Manufacture, ProductName indicate the need for normalization to eliminate redundancy and anomalies.

Normalization and Data Integrity

Applying normalization rules ensures the tables are in 3NF, which eliminates update, insert, and delete anomalies. For instance, in the Inventory table, the dependency WarehouseID → StaffName (multivalued) suggests a separate Staff table linked by a FK.

Enforcing referential integrity involves setting foreign keys with cascade options for deletions or updates to prevent orphan records, especially when deleting division records or adding employee records.

Handling Anomalies

Insert anomaly: Adding a new product without specifying stock in warehouses is prevented by separate tables and constraints. Update anomaly: Changing product description in one table automatically updates all related records due to normalization. Delete anomaly: Removing a product or warehouse that is linked to existing orders or stocks is managed via proper cascade delete rules or setting values to null.

Conclusion

This comprehensive modeling and normalization process optimize database integrity, reduce redundancy, and facilitate consistent data operations, backed by best practices in relational database design.

References

  • Breckenkamp, J., Patterson, L., Scharlach, M., Hellmeier, W., & Verma, A. (2017). Definitions of urban areas feasible for examining urban health in the European Union. European Journal of Public Health, 27(suppl_2), 19–24.
  • de Jong, L., Pavlova, M., Winters, M., & Rechel, B. (2017). A systematic literature review on the use and outcomes of maternal and child healthcare services by undocumented migrants in Europe. European Journal of Public Health, 27(6), 990–997.
  • Fanourgiakis, J., & Kanoupakis, E. (2016). An assessment of the results of European Parliament elections in Greece and European Union under the shadow of economic crisis. International Journal of Health Services, 46(4), 642–655.
  • Kazzazi, F., Pollard, C., Tern, P., Ayuso-Garcia, A., Gillespie, J., & Thomsen, I. (2017). Evaluating the impact of Brexit on the pharmaceutical industry. Journal of Pharmaceutical Policy and Practice, 10, 32.
  • Lippi, G., Mattiuzzi, C., & Cervellin, G. (2016). No correlation between health care expenditure and mortality in the European Union. European Journal of Internal Medicine, 32, e13–e14.
  • Puchner, K., Karamagioli, E., Pikouli, A., Tsiamis, C., Kalogeropoulos, A., Kakalou, E., … Pikoulis, E. (2018). Time to rethink refugee and migrant health in Europe: Moving from emergency response to integrated and individualized health care provision for migrants and refugees. International Journal of Environmental Research and Public Health, 15(6), 1100.
  • Sighem, A., Pharris, A., Quinten, C., Noori, T., Amato-Gauci, A. J., & Networks, the E. H. S. and D. D. M. (2017). Reduction in undiagnosed HIV infection in the European Union/European Economic Area, 2012 to 2016. Eurosurveillance, 22(48), 17–00771.
  • European Commission. (n.d.). Public health. Retrieved July 4, 2019, from European Commission website.
  • Laureate Education (2011). Global health and issues in disease prevention [Multimedia file].