South American Database Design Guide
South American Database Design Guide
Database
Database design
Produced by:
Jhonny Peñaloza
Andrés Pesantez
Alex Sanmartín
Jorge Enderica
1
2009
INDEX
Page.
Cover
Index............................................................................................II
Introduction
CHAPTER I
Theoretical Framework
1. Database....................................................5
1.1 advantages.....................................................5
1.2 Types of Databases...........................................................5
2. The DBMS.............................................6
3. Database Design…………...............8
3.1 identification of entities..................................................9
2
5. Functional Dependency…………………………….………..…..….10
6. Normalization………………………………………………...…..………………..……11
CHAPTER II
Development
1. Identification Entities……………………..…………………………………….…13
2. Relationship Entities………………………………………..………………..……13
3. Normalization…15
4. Identification of Tables….21
5. Relational Model………..22
CHAPTER III
1. Conclusiones.……………………………………………………………………………23
2. Recommendations….24
3. Glossary….25
4. Bibliography..........................................................…………..26
3
5. Annexes…............27
Introduction
Currently, the company handles a large amount of data, as this data is a key piece in the
the company's operation must have them stored in a database and managed by
an automatic way to be able to treat them and handle them entirely correctly in
the aspects that the company carries out to avoid wasting time and money
valuable.
One of the crucial steps in building an application that handles a database is the
database design.
If the tables are not defined properly, we may have many inconveniences at the time.
to execute queries on the database to try to obtain some information.
The functionality of the database should not vary significantly if, for example, our
The database has only 20 records, or 1000 records, it is important to ensure that our database
The data structure is designed correctly to ensure efficiency and to be usable.
for a long time.
This work will provide the basic parameters for designing a database.
The complexity in the database design will depend on how much and what information will be.
stored in the same and is unique for each case, but all will be based on the same principles
what we will notice in the present document.
4
Theoretical Framework
Database.
Advantages of Databases.
1. Data independence and processing. Change in data does not imply change in
programs and vice versa (Lower maintenance cost).
3. Improvement in data availability. There is no data owner (But they are not public).
we save description.
Types of Databases.
By Content.
• Hierarchical. Inverted tree form, it can represent two types of relationships between the
data: one-to-one relationships and one-to-many relationships, there is redundancy.
• Red. This model allows for many-to-many representation, in such a way that
any record within the database can have several occurrences greater than
5
He. The network model avoids redundancy in information, through the incorporation of a
a type of record called the connector.
• Relational. This model is being used more frequently in practice, due to the
advantages it offers over the two previous models, among them, the quick understanding
from users who do not have in-depth knowledge about Database Systems
Data.
• Multidimensional. Similar to the relational, this stores database structures.
• Object-oriented. Relates the state and behavior of data.
• [Link] text indexing
• Distributed. Stored on several computers
• Deductive. Through inferences (applied to the scientific environment)
We will focus on the relational form which is the most commonly used.
The DBMS: is a set of programs that handle the creation and all accesses.
to databases, are a very specific type of software, dedicated to serving as an interface between the
database, the user and the applications that use it, is composed of:
• DDL (Data Definition Language): Data Definition Language. Through this, the
DBMS identifies the descriptions of the elements of the schemas and stores them
description of the schema in the DBMS catalog. Through this, the DBMS specifies the
conceptual and internal schema (Stored Database).
The capacity of DBMS is defined by its engine, that is, the amount of data it can handle.
able to drive.
Objectives.
• Minimum redundancy. In those cases where it has not been possible to eliminate the
redundancy, it will be necessary to monitor that the information appearing repeatedly
6
• Data integrity. It involves taking the necessary measures to ensure the
validity of the stored data.
• Optimized complete queries. It is desirable to minimize the time the DBMS takes to
give us the requested information and store the changes made.
• Access security and audit. They must ensure that this information is available.
secure against malicious users who attempt to read confidential information.
• Backup and recovery. They must provide an efficient way to perform copies of
backup of the information stored in them, and to restore from these copies the
data that may have been lost
Purpose
Diagram of a DBMS
7
Users of a Database Management System
• DBA staff
• Sporadic Users
• Application Programmers
• Parametric users
DATABASE DESIGN
It is the basis of the entire process since if the design is solid, implementing it will not present us with
major problem.
1. Identification of Entities
2. Relationship of Entities
3. Identification of tables
4. Identification of keys
5. Data types and length
6. Normalization
[Link] model
Entity Identification.
A person, place, thing, or concept that it has characteristics of interest for the
company.
Relationship of Entities.
Identify which entities are involved in the processes, and for the practice, they intertwine with
a word that identifies the process and directional arrows. Example:
Table identification.
It is to generate the table for each entity defining the fields or records that are
necessary for each of them.
Identification of keys.
A primary key is that column (it can also be two columns or more) that
identify only that row. The primary key is an identifier that will be unique
for each row. In a table, we may have more than one key, in that case it can
9
choose one to be the primary key, the other keys are the candidate keys. In addition
it is the possible primary key.
A foreign key is that column which, existing as a dependent in a table, is to
primary key in another table.
An alternative key is that candidate key that has not been selected as a key.
primary, but can also uniquely identify a row within a table.
Example: If in a customer table we define the document number (customer id) as
primary key, the customer’s social security number could be an alternate key.
In this case, it was not used as a primary key because that data may not be known.
in all clients.
A composite key is a key that consists of more than one column.
Pk =clave principal
Fk =clave foránea
Nn = not null
Uk = unique
Ck =clave de chequeo
This defines the type of information that will be stored in each field.
It can be defined in various types such as text, numeric, monetary, date, etc.
We also need to define the length of the field, that is, what load it would support, for example.
we define the fieldname of type text of length 30, this tells us that the
field name will store text data up to 50 characters.
Functional dependency
10
Reflexive. It helps us to obtain records that are directly related to the
main key. For example:
Account Number
Name
Account Number
Account type
Account statement
Account balance
Transitive. It is the interpretation that one attribute depends on another, and this one depends on another.
For example:
Fecha_Nacim
Age
Can Drive
Normalization.
11
In the relational model, it is common to refer to a relation as a table, although for a
a table is considered a relation if it meets certain constraints:
Table relationship.
1 to 1
When entering a record in one field, we simultaneously enter one in another.
field (but only one at a time)
1 to various
12
It allows a field to be related, and you can enter several in a field.
records.
Many to many
It establishes that several fields with multiple records can have several associated.
fields also with several records.
13
Development
The data for the development of the following points were based on the information
previously collected in the company's analysis.
IDENTIFICATION OF ENTITIES
After conducting the preliminary analysis, the following entities are determined:
• Invoice
• Products
• Seller
• Warehouse keeper
• Delivery person
• Clients
LIST OF ENTITIES
Receive Describe
Delivery
Wine cellar worker
Delivery person
14
.
Company
Contract
Acquire Product
Employees
Provide Provider
Receive Roll Payment
After establishing the relationship between entities, this will give us the guideline for
define the tables we will use as well as what fields the table will contain.
For example:
We identified the client table and its fields name, surname, type, address, phone.
ID card, RUC, etc....
Then we proceed to carry out the normalization, respectively that is necessary for each
table.
15
NORMALIZATION
First Normal Form
We look for the multivalued fields, and we create a field for each one.
Invoice
Number 1 Employees
Date 12/12/2020 ID card 0104900881
Client juan Name Luis
RUC/CI 0104900881 Last name Perez
Code c001 Address Luis Cordero
Address Bolivar Telefono1 2809090
Telephone 809090 Telephone2 096398610
Seller pedro
gender male
product1 prod1
Fecha_nacim 15/05/1980
product2 prod2
marital status single
Cantidad1 1
[Link] 5 Fecha_ingres 12/11/2009
V. Total2 10 Cargo1 seller
Subtotal 13 Cargo2 cashier
Ivy 1.56 Salary 250
Discount 0 Schedule 1 7:00- 11:30
Total a Pagar 14.56 Schedule2 15:00-23:00
Products
Code p001
Name video
Description Vittorio video Clients
Existence 400 Code C001
entry_date 03-may-09 ID/Ruc 0104900881
date_prepared 24-abr-09 Name Juan
fech_expedicion 05-jul-09 Surname Lopez
Presentation1 500 grams. Direction G. Colombia
Presentation2 200 grams. Phone1 808070
Purchase Price 0.5 Phone2 096398610
Sale Price 0.75 Gender male
Supplier Azuero Aso. Type retailer
16
Provider
RUC 1658974035698
Name Azuero Aso
Contact Rafael Cuesta
Address Octavio Chacon
Telefono1 808070
Telephone2 096398610
Fax1
Fax2
E-mail1 infAzuer@[Link]
E-mail2 DistAzuer@[Link]
Product_distributionVideo
marca_product Vittorio
Invoice
Numero_fact 1
Date 12/12/2020
Client juan
RUC/ID 0104900881
Code c001
Address Bolivar
Telephone 809090
Seller Pedro
Amount1 1
Unit Value 5
V. Total2 10
Subtotal 13
Ivy 1.56 Product_Invoice
Discount 0 numero_Fact 1
Total a Pagar 14.56 product name video
17
Employees
ID card 0104900881
Name Luis
Last name perez
Address Luis Cordero
Telephone 2809090 Cargos_Empleados
Cell phone 096398610 ID Card 010265814 010265814
gender male Cargo seller cashier
Fecha_nacim 15/05/1980
marital status single Employee_Schedules
Fecha_ingres 12/11/2009 ID card 010265814 010265814
Salary 250 schedule 7:00 - 11:30 15:00 - 23:00
Products
Codigo_prod p001
Name noodle
Description of the video Vittorio
Existence 400
fech_ingreso 03-may-09
fech_elaborad April 24, 2009
dispatch_date 05-jul-09
Purchase Price 0.5 Product_Presentation
Selling Price 0.75 product_code001
Provider Azuero Aso. presentation 200g
Client
Code C001
Cedula/Ruc 0104900881
Name juan
Last name Lopez
Direction G. Colombia
Telephone 808070
Cell phone 096398610
Genero male
Type retailer
Provider
RUC 1658974035698
Name Azuero Aso Supplier FAX
Contact Rafael Cuesta RUC 1658974035698
Address Octavio Chacon Fax
Telephone 808070
Cell phone 096398610 E-MAIL_Proveedor
Product_distNoodle RUC 1658974035698
brand_productVittorio e-mail infAzuer@[Link]
18
It was not necessary to separate the phones into a table, just separated into two fields and the
let's rename landline and mobile phone
Invoice Product_Invoice
Numero_fact 1 numero_Fact 1
Client john nom_product video
RUC/ID 0104900881
Code c001 Fecha_Factura
Address Bolivar date_code I001
Phone 809090 date 12-may-09
Seller peter
Cantidad1 1 Tax Invoice
[Link] 5 codigo_impuesto Im001
V. Total2 10 value 1.56
Subtotal 13
Total a Pagar 14,56 Invoice_Discounts
discount_code_dsc001
0 0.00
Employees
Identity card 0104900881
Name Luis Employee_positions
Last name perez Codigo_cargos Carg001 Carg002
Address Luis Cordero Cargo seller cashier
Phone 2809090
Cellular 096398610 Employee_Schedules
gender male schedule_code_hour001 hor002
Fecha_nacim 15/05/1980 schedule 7:00 - 11:30 15:00 - 23:00
marital status single
Fecha_ingres 12/11/2009 Sueldo_Empleados
Cod_Cargos 250 Schedule Code hor001 hor002
Code_Schedules 250 Amount 250 300
Salary_code 250 Description warehouse seller
19
Products
Codigo_prod p001 Product Presentation
Name video codigo_presp001
Description Vittorio video 200g presentation.
Existence 400
fech_ingreso 03-may-09 Product Entry Date
date_prepared 24-abr-09 code_entryI001
fech_expedicion 05-jul-09 date 12-may-09
Precio Compra 0.5
Selling Price 0.75
Provider Azuero Aso.
presentation_code p001
codigo_ingreso I001
20
TABLE DESCRIPTION
CONSTRAINS, TIPOS DATOS, LONGITUD
Luego de llevar a cabo la normalización ya tenemos definida la estructura de las mismas, el
The next step will be to define what type of data will be stored in its fields, and how much.
it will store, also if any field will serve as a link with another table that is to say if it is a key
Master_invoice
constrain field data type length
NN FK date_code char 4
PK NN invoice number int 4
NN FK product_code char 4
NN FK codigo_impuesto char 4 Invoice_Detail
NN FK discount_codechar 4 constraint field data type length
NN FK client_code char 4 PK NN invoice number 4
NN subtotal real (5,2) NN FK amount int 3
NN Total a Pagar real (5,2) NN FK unit price real (5,2)
NN FK employee_id 10 NN FK v. total real (5,2)
NN character state 8 NN FK production_code char 4
Customer_invoice
constrain field data typelength
PK NN client_code char 4
FK RUC/ID char 13
EMPLOYEES
client constrain field data type length
constrain field data type length PK NN cedula_empleado char 10
PK NN client_code char 4 NN name character 30
FK RUC/CI character 13 NN last name character 30
NN name character 25 NN FK address character 50
NN FK surname character 25 NN telephone character 9
Direction character 50 NN cell phone character 9
telephone character 9 NN gender char 7
cell phone character 9 NN fecha_nacim date
gender character 7 NN estado_civil date
NN type character 8 NN fecha_ingreso date
Empleados_sueldo Employees_position
constrain field data typelength constrain field data type length
NN employee ID 10 NN employment_card 10
PK NN codigo_sueldochar 4 PK NN cargo_code 4
21
Empleados_horarios salaries
constrain field data type length
constrain data type fieldlength
PK NN codigo_sueldochar 10
NN employer card 10 NN character description 25
PK NN schedule_code char 4 salary real (5,2)
schedules charges
constrain field data type length constrain field data type length
PK NN schedule_code char 4 PK NN codigo_cargo char 4
NN schedule char 13 NN cargo character 15
Products
constrain field data type length
PK NN product_code char 4
Supplier
FK nombre character 20
field constraint data type length
NN description char 60
PK NN Name character 30
NN FK existence char 25
NN fecha_ingreso date FK Contact char 60
NN fecha_elaborado date NN Direction character 50
NN fecha_expedicion date NN FK Phone character 9
NN precio_compra real (5,2) NN Cell phone character 9
NN precio_venta real (5,2) NN RUC_supplier 13
NN Supplier RUC char 13 NN fax_code char 4
presentation_code 4 NN email_code char 4
E-mail_Proveedor
constrain field data type length
email character 30
PK NN email_code char 4
22
Relational Model
23
CONCLUSIONS
After the development of this project, and based on the data acquired and the practice carried out, we have
reached the following conclusion:
24
Recommendations
After developing this document and experiencing the base design of
From the data, we can give the following recommendation:
25
GLOSSARY
Rule = table or file
RDBMS = From English Relational Data Base Manager System which means, System
Relational Database Manager.
26
BIBLIOGRAPHY
[Link]
[Link]/~mmarques/f47/apun/[Link].
[Link]
http:/ /[Link]/articulos/[Link]
[Link]
[Link]/[Link]
27
Designer captures and database in Access, SQL
Implanted in Access
28
Implanted in SQL
29