You are on page 1of 7

VIRTUAL UNIVERSITY OF

THE STATE OF

GUANAJUATO

NAME: MODULE: DATABASE


FUNDAMENTALS
ENROLLMEN
CHALLENGET:
4: TRANSFORMATION OF MY
DATABASE

uveg
of the state of quanaiuabo
DATA
PREPARATION: WEDNESDAY, NOVEMBER 10

DE 2021.
STEP 1: ENTITY-RELATIONSHIP MODEL

• La Comercializadora de libros: Márquez S.A. de C.V. has various products for women,
men, children, children's and adults.
• and girl, which requires the generation of an Entity-Relationship Model for inventory
control and sales management.
• It is required to prepare 4 tables: products, employees, customers and sales.
• The following fields should be considered in the Products table: product code, product
name, type, date of purchase, date of sale and quantity in stock.
• The following fields must be considered in the Employees table: employee ID, employee
name, address, telephone and CURP.
• The following fields should be considered in the Customers table: customer
number, customer name, address, e-mail, payment method, and RFC for
invoicing.
• The following fields should be considered in the Sale table: sale code, date of
sale, form of payment and total to be paid.
• The following relationships exist:
One product can appear in many sales and one sale can have many products, i.e. a many-
to-many relationship between sale and product.
VOneemployee can make many sales, i.e. one-to-many relationship between employee
and sale.
Onecustomer can be involved in many sales, i.e. one-to-many relationship between
customer and sale.
TABLE S
Products Employee
Product_Code Customer Employee_Id
Product_Name Customer number Name For sale
Type Name Address Sales code
Quantity in stock Address Phone Date of sale
Date of purchase E-mail CURP Form of
Date of sale Form of payment payment
Total payable
RFC
STEP 2: RELATIONAL MODEL.

- In the Entity-Relationship Model previously elaborated, the transformation to


Relational Model must be done, for this, you must define the fields of each table. Add
the information as you see fit in your diagram, i.e. add the primary keys to the
corresponding tables, the employee_id field to the sales table. Make your own
definition as you consider most appropriate for all the fields defined in your tables.
Employee Customer_number Int
PK Not Null
Employee_ID Int Pk Not Null Customer_name Varchar(50)
1:1 Not Null
Name Address Varchar(50) Not Null Customer address Varchar(50)
Not Null
Phone CURP Varchar(50) Not Null S /

_
Null 1:M 1:M Varchar (20) Not Null
Varchar(15)
Payment_Fo Not Null
Varchar(18) Not Null Varchar (13)
rm
Varchar (50) Null
RFC \ 1 /
X P
For sale
Cod Sale Int PK Not Null P
_ M:
Date_Sale Date Not Null
1:M 1:M Payment_Form Date Not Null M 1:M
Total Decimal (6,2) Not Null
Employee_code Int FK
Customer code Int FK Products
- Product_Code Int PK Not Null
Product_Name Varchar(50) Not Null
1:M > Type Varchar(50) Not Null
Size Decimal (2,2) Not Null
Date of sale Dat C Not Null
z
Z
Dat u
Date of purchase Not Null
PrSales_product e s
od 1:M Quantity in stock t
Cod_Sale
uct
Int FK — ///// _4 _44 Int
o
Not Null
_c I m
od n F e
e t K r

You might also like