Documentation Technique
Documentation Technique
Documentation Technique
MANAGEMENT
Technical report
Contents
Technical report.............................................................................................................. 0
Content............................................................................................................................ 1
INTRODUCTION............................................................................................................... 2
Conceptual Data Model (CDM) and Logical Data Model (LDM).....................................3
1. Conceptual Data Model (CDM)....................................................................................... 3
Relationships and Cardinalities................................................................................... 4
Relationship Interpretation......................................................................................... 4
2. Logical Data Model (LDM)..............................................................................................5
Database schema.............................................................................................................6
1. Database creation...........................................................................................................6
2. Tables creation............................................................................................................... 6
Table documentation...................................................................................................... 9
1. Category Table................................................................................................................ 9
a. Fields................................................................................................................... 9
b. Constraints.......................................................................................................... 9
2. Supplier Table.................................................................................................................9
a. Fields................................................................................................................... 9
b. Constraints........................................................................................................ 10
3. Product Table................................................................................................................10
a. Fields................................................................................................................. 10
b. Constraints........................................................................................................ 10
4. Order Table................................................................................................................... 11
a. Fields................................................................................................................. 11
b. Constraints........................................................................................................ 11
1
INTRODUCTION
2
Conceptual Data Model (CDM) and Logical
Data Model (LDM)
3
Entities and Attributes
● Category - Product (1:n): One category can have many products, but a
product can only belong to one category. This is a one-to-many
relationship.
● Product - Supplier (1:n): One product can be supplied by one supplier,
but a supplier can supply many products. This is also a one-to-many
relationship.
● Product - Orders (1:n): One product can be part of many orders, but
an order can contain many products. This is another one-to-many
relationship.
Relationship Interpretation
4
● Product and Supplier: one supplier can provide several products.
● Product and Orders: A product can appear in many orders as
customers purchase it multiple times.
A logical data model represents the structure of the data elements and
the relationships between them without focusing on how they will be
physically implemented in the database. It includes entities, attributes, and
relationships, often depicted in an Entity-Relationship Diagram (ERD). Based
on the previous schema, here's a logical data model:
5
Database schema
1. Database creation
CREATE DATABASE `Supermarche`;
2. Tables creation
● Product
`description` TEXT,
6
● Supplier
contact VARCHAR(255),
address TEXT,
telephone VARCHAR(20)
);
● Orders
);
7
● Category
);
8
Table documentation
1. Category Table
a. Fields
- category_id: Integer, Primary Key, Auto Increment, Unique
identifier for each category.
- name: VARCHAR(255), Not Null, The name of the category.
b. Constraints
- PRIMARY KEY (category_id): Ensures that each category has a
unique identifier.
2. Supplier Table
a. Fields
- supplier_id: Integer, Primary Key, Auto Increment, Unique
identifier for each supplier.
- name: VARCHAR(255), Not Null, The name of the supplier.
- contact: VARCHAR(255), Contact information for the supplier.
- address: TEXT, Address of the supplier.
- telephone: VARCHAR(20), Telephone number of the supplier.
9
b. Constraints
3. Product Table
a. Fields
- product_id: Integer, Primary Key, Auto Increment, Unique
identifier for each product.
- name: VARCHAR(255), Not Null, The name of the product.
- description: TEXT, Description of the product.
- price: DECIMAL(10,2), Not Null, Price of the product.
- stock: INT, Not Null, Default 0, Quantity of the product in stock.
- supplier_id: Integer, Not Null, Foreign Key referencing
`Suppliers.supplier_id`.
- category_id: Integer, Not Null, Foreign Key referencing
`Categories.category_id`.
b. Constraints
- PRIMARY KEY (product_id): Ensures that each product has a
unique identifier.
- FOREIGN KEY (category_id) REFERENCES Categories
(category_id)`: Ensures that each product is associated with a
valid category.
- FOREIGN KEY (supplier_id) REFERENCES Suppliers (supplier_id)`:
Ensures that each product is associated with a valid supplier.
10
4. Order Table
a. Fields
- order_id: Integer, Primary Key, Auto Increment, Unique identifier
for each order.
- quantity: Integer, Not Null, Quantity of the product ordered.
- order_date: DATE, Not Null, Date of the order.
- product_id: Integer, Not Null, Foreign Key referencing
`Products.product_id`.
b. Constraints
- PRIMARY KEY (order_id): Ensures that each order has a unique
identifier.
- FOREIGN KEY (product_id) REFERENCES Products (product_id):
Ensures that each order is associated with a valid product.
11