Vous êtes sur la page 1sur 6

Isabela State University Cauayan Campus

18 Dacanay, Cauayan City, Isabela

COLLEGE OF COMPUTING AND TECHNOLOGY


Masters in Information Technology
Activity 2 – Database Introduction and Relationships
Database Design
Jaydwin T. Labiano
MIT1 Student

I. Introduction
In part of the database design, relational database is an example which contributed to the common
knowledge of separating everything into separate tables like MySQL and it is a big process. It is fun and
interesting to learn Database design for I.T or computer science students or professionals. It is important
also to manifest a good implementation of database for almost every activity, it is powered by database. In
business, database is also important to optimized data for your project like websites and some
administrator database is all they need. Database designing doesn’t need direct coding into programs, it
needs logics and critical thinking from scratch to implementation. In other words, when starting database
designing all we need is to plan first the design before putting them at work.

II. What is a database?


Something that stores data (anything we can store, write down or has a value).

Fig. 1: Database

DATA
Let the shape rectangle the table and the tesxt as data. This explains that data can
be stored in a table.

Fig. 2: Database Location (Back_End)

Log-In Details
UN:__________
PW:__________
DATABASE
NAME UN PW
jaydl 12345 Jaydwin L.
Profiles Details
Name: Jaydwin L.

Back-End is the where the database resides in software. It cannot be seen by the
users but it helps in collecting data to be retrieved during the execution processes.
Front -End (Log-In Details & Profiles Details) is what the user sees. It is the
graphical user interface where interaction between the user and the software in made.

III. What is a Relational Database?


Relation is the connection between data.

Fig.3: Sample Database

Name Username Password


Jayd Jayd1 12433
Andrea AndreaLove Ddwin123
Mae Mae14 Maemae1234

Entity – anything that we store data about.


Ex: A user
Attribute – things we store
Ex: hair color, status, address,age

1
Isabela State University Cauayan Campus
18 Dacanay, Cauayan City, Isabela

COLLEGE OF COMPUTING AND TECHNOLOGY


Masters in Information Technology
Activity 2 – Database Introduction and Relationships
Database Design
Name, Username, Password are samples of Attribute shown in Fig. 3. And each attribute
points to person.

Entity Type – category of entities such as the user or the person.


Attribute Type – category of attributes such as name, username, password

In Fig. 3, the columns are the attributes and the rows or tuples are individual entities

IV. Relational Database Management System (RDBMS)


DBMS - A database management system stores data in such a way that it becomes
easier to retrieve, manipulate, and produce information [1].
MySQL and MySQL Server - Allows as to build and run database

Fig. 4. DBMS [2]

DBMS has users with different rights and permissions who use it for
different purposes [2]

V. Introduction to SQL
SQL – Structured Query Language, it defines (Data Definition Language) the structure and manipulates
(Data Manipulation Language) that structure.

SQL Main Categories


1. DDL (Data Definition Language) - consists of those commands in SQL that directly create
database objects such as tables, indexes views. A lot of SQL commands also create temporary
database objects during processing [3].

Example Query:
CREATE TABLE User (name varchar (255), Username varchar (255),Password varchar
(255));

2. DML (Data Manipulation Language) – consists of those commands which operate on the data in
the database. This includes statements which add data to the table as well as those statements
which are used to query [3].

Example Query:
INSERT INTO User values(“Jaydwin”,”JAYD!@#”,”qwerty12”);

2
Isabela State University Cauayan Campus
18 Dacanay, Cauayan City, Isabela

COLLEGE OF COMPUTING AND TECHNOLOGY


Masters in Information Technology
Activity 2 – Database Introduction and Relationships
Database Design

VI. Naming Convention [4]


- Pattern that people do to keep things consistent in database across tables and columns.

Different Naming Conventions:


Examples:
- Using prefixed by the name of the table that column is part of like DEPT_NO
- Can be all capital letters for tables and capital letter for the first letter of the column or attributes then
separated by underscore when there is succeeding word.

VII. What is Database Design?

Database design is the organization of data according to a database.


3 Sections (Schemas) the way data is structured.:
1. Conceptual
2. Logical
3. Physical

Database design used schemas from general to specific. As it goes on the physical schema it becomes
more specific. This design consists of the relationships of tables in the database. We can have multiple
tables to store data in database to avoid data duplication.

VIII. Database Integrity


- Having correct data in database that is without duplicate values, incorrect values and broken
relationship within tables.
Examples:

USER Sale

This means that there is no sale if there’s no user and vice versa. User and Sale have their
relationship and they point to each other to maintain integrity.

Entity Integrity basically means unique entities.


Example:
Name Phone
Jayd 0912345678
Jayd 0974545746

This refers to we can have same names but different individual which is a bad integrity because no
references of uniqueness so we can add an ID like the table below.

ID Name Phone
7 Jayd 0912345678
8 Jayd 0974545746

The ID now can be the reference as foreign key in order to identify the person or user who say for
example commented on a post.

While domain integrity is the acceptable values of for a column or what we store as range.
ID Name Phone
7 Jayd 0912345678
8 Jayd house

In the table, row 2, column phone there is a problem in the domain because it should be a number
and “house” is a ten digit number.

Data type – put limits to what we allow to store.

3
Isabela State University Cauayan Campus
18 Dacanay, Cauayan City, Isabela

COLLEGE OF COMPUTING AND TECHNOLOGY


Masters in Information Technology
Activity 2 – Database Introduction and Relationships
Database Design
Examples:
Char (25)
This means that we can only put 25 characters.

IX. Database Terms


1. Data – anything we store in the database
2. Database – where we store data.
3. Relational Database – store things in table
4. DBMS – manage a database using code.
5. RDBMS – use to control our tables and values.
6. Null – no value in a table.
ID Fax_No
004 Null
7. Anomalies – errors within the data within data integrity.
8. Integrity – protects against anomalies.
i. Entity – uniqueness among table
ii. Referential – keeps connections of tables
iii. Domain – column within a table with specific data type
9. Entity – anything we store data about.
10. Attributes – thing we store about the entity.
11. Relation – table connections.
12. Tuple – a row, all attributes about specific entity.
13. Table – what where we store data to organize data
i. Rows – specific individual entry
ii. Columns – specific attribute of entity
14. File - table
15. Record - row
16. Field – column
17. Value – information to put in a specific column
18. Entry – a row
19. Database Design – process of designing table to remove anomalies to maintain data integrity.
20. Schema – physical or drawn out structure of database.
21. Normalization -steps to follow to have best database design.
22. Naming Conventions – consistency use to make data, database, tables etc.
23. Keys – make everything unique and use for connections.
24. SQL – Structured Query Language
25. DDL – Data Definition language – use to define structure of database
26. DML – Data Manipulation language -Insert values of in database
27. SQL Keywords – reserved words for queries not use for querying
28. Frontend – what the user sees
29. Backend – what’s going on behind the scene.
30. Client side – can accessed database depending on the privilege
31. Server side – serves instances to clients of database based on the privileges given
32. Server Side Scripting language – use to communicate from client side to server side
33. Views – organization of data in frontend from database but different views like tables and users.
34. Joins – connect data from multiple table to create new table.

4
Isabela State University Cauayan Campus
18 Dacanay, Cauayan City, Isabela

COLLEGE OF COMPUTING AND TECHNOLOGY


Masters in Information Technology
Activity 2 – Database Introduction and Relationships
Database Design

X. Atomic Value
- Stores one thing
Example:

fname mname lname


Jaydwin Torres Labiano
Andrea Mae Marcelo Labiano

We should store to fname all the first names and middlename all middle names and so with the last
names.

XI. Relationships
- Connections of tables in database.

Entity 1 Entity 2
name Favorite_Color
Jayd Red

Relationship

3 Types of Relationships:

1. One to One Relationship – one entity has a connection with one entity
Example:
husband – wife
This means that husband can only have one wife and wife can have one husband.

2. One to Many relationship – one entity can have a connection to multiple other entities.
Example:
user – multiple comments

3. Many to Many Relationship –


Example:

When a guy marries multiple wives and wife marries multiple guys it many to many
relationship.

5
Isabela State University Cauayan Campus
18 Dacanay, Cauayan City, Isabela

COLLEGE OF COMPUTING AND TECHNOLOGY


Masters in Information Technology
Activity 2 – Database Introduction and Relationships
Database Design

XII. Designing One to One Relationship 1:1

Cardholder Card
ID ID
FN Card no
Card_ID Issue date

This means that a cardholder can only have one card. And a one card can only be used by one
cardholder.

XIII. Designing One to Many Relationship 1:N


User Card
USerID CardID
FN Card no
LN USerID

This explains that a user can have multiple card but one card can only have one User.

XIV. Parent Tables and Child Tables

Parent – Child
This considers the Parent as the Primary Key (PK) and the Child as Foreign Key (FK)
Foreign Key – points out the primary key.

Child FK

Parent PK Child FK

Child FK

XV. Designing Many to Many Relationships M:N

Example:

References:
[1] www.tutorialspoint.com, “DBMS Database Management System”, Tutorials Point (I) Pvt. Ltd. ,pp.1,2015.
[2] www.tutorialspoint.com, “DBMS Database Management System”, Tutorials Point (I) Pvt. Ltd. ,pp.2,2015.
[3] Akeel I Din,”Structures Query Language (SQL) A Practical Introduction”, NCC Blackwell, pp.21.
[4] Shane Lively & Michael Sarsany,”SQL Server Standards”, www.isbe.net,pp.1-24.

Vous aimerez peut-être aussi