You are on page 1of 3

COMPUTER 3RD QUARTER

DML COMMANDS DATABASE NORMALIZATION


DATA MANIPULATION LANGUAGE ● process to sort out redundant data
● view, filter, insert, delete, and update data ● restructuring the tables
● used for managing data in a database ● characteristics:
● not auto-committed – scalar values in each field
● permits data rollback – absence of redundancy
– minimal use of null values
– minimal loss of information
INSERT
● add/insert a value/data in your table INSERT ANOMALY
● situation where it is impossible to insert certain
types of data into the database

DELETE ANOMALY
● deletion of data leads to unintended loss of
additional data (data that we wanted to keep)

UPDATE ANOMALY
● updating the value of a column leads to
database inconsistencies
● different rows on the table have different
values

1NF FIRST NORMAL FORM


UPDATE ● only contains atomic values
● edit/modify the content of your table – value that cannot be divided
● edit/modify one or more records ● no repeating groups
– contains two or more columns that are closely related
[Book ID], [Author 1], [Author 2], [Author 3]

DELETE
● removes unnecessary data from your table
● removes one or more records from a table
according to a specified condition

[Color] column contains multiple values



SPLIT INTO TWO TABLES
SELECT
● allows you to view the contents of your table
● retrieves rows from a table
● most commonly used command
● extracts data from the database

TO FETCH ALL RECORDS


2NF SECOND NORMAL FORM 3NF THIRD NORMAL FORM
● in 1NF ● in 2NF
● all ¹non-key attributes must be functionally ● no transitive dependency
dependent on the ²primary key – when non-keys depends on other non-keys
other than the primary key
– ¹column,not a primary key or part of the
composite primary key ● relationships in the table:
– ²column, unique identifier A is functionally dependent on B, and B is functionally
● no partial dependency dependent on C. In this case, C is transitively dependent on
A via B.
– when an attribute is not fully dependent on
the primary key

[Book ID] determines [Genre ID], and [Genre ID] determines


composite primary key: [Customer ID, Store ID] [Genre Type]. [Book ID] determines [Genre Type] via
non-key attribute: [Purchase Location] [Genre ID].
[Purchase Location] → [Store ID] ↓
↓ SPLIT THE TABLE INTO TWO
BREAK INTO TWO TABLES [TABLE_BOOK] – both [Genre ID] and [Price] are only
dependent on [Book ID].
[TABLE_STORE] – [Purchase Location] is fully dependent
[TABLE_GENRE] – [Genre Type] is only dependent on
on the primary key of that table, which is [Store ID].
[Genre ID].
ESTABLISHING RELATIONSHIPS INSERTING AND DELETING DATA IN
BETWEEN TABLES – ER DIAGRAM TABLES WITH RELATIONSHIPS
ENTITY RELATIONSHIP DIAGRAM
PRIMARY KEY
DATA MODELING ● designed to uniquely identify
● examines the data objects in a system the content of a table
● identifies the relationship between these ● primary key → another table = relationship
objects
FOREIGN KEY
ER DIAGRAM NOTATION ● provides the link between two tables
● entities
– person, place, object, event
– concept about which data is to be maintained
– set of real-world objects that share same properties
● attributes
– named property or characteristic of an entity
● relationship
– association between the instances of
one or more entity types

CHEN AND CROW’S FOOT MODEL

1:1 RELATIONSHIP
● a student fills a seat.

1:M RELATIONSHIP
● an instructor teaches a course

M:M RELATIONSHIP
● a student takes a course.

You might also like