Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Module 2 Working

with Data
Topics to be covered in this Module

❖ Introduction to Data
➢ What is Data
➢ Types of Data
➢ Data Storage
➢ Data Retrieval
❖ Normalization in SQL
➢ First Normal Form (1NF)
➢ Second Normal Form (2NF)
➢ Third Normal Form (3NF)
➢ Advantages of Normalization
❖ Constraints in Database
❖ Primary Key
❖ Foreign Key
Introduction to Data

● What is Data: Data refers to a collection of facts or information that is stored in a structured or
unstructured format. It can be in the form of text, numbers, images, audio, or video.
● Types of Data: There are mainly two types of data: structured data and unstructured data. Structured
data is organized in a predefined format and can be easily stored, accessed, and processed.
Unstructured data, on the other hand, is not organized and is difficult to process.
● Data Storage: Data can be stored in various formats, such as files, databases, and data warehouses.
Databases are the most common way of storing data, and they are used to store structured data.
● Data Retrieval: Data retrieval refers to the process of accessing the stored data. It is done through a
query language, such as SQL, which allows users to retrieve data based on specific criteria.
Normalization in SQL

First Normal Form (1NF): This is the first step in normalization and involves removing any repeating groups
of data from a table.

Second Normal Form (2NF): This step involves eliminating partial dependencies by creating separate
tables for each set of related attributes.

Third Normal Form (3NF): This step involves eliminating transitive dependencies by creating separate
tables for each set of attributes that do not depend on each other.

Advantages of Normalization: Normalization improves the efficiency of data retrieval and ensures that the
data is consistent, accurate, and easy to manage.
Constraints in Database
What are Constraints -
Constraints are rules that are applied to the data in a database to ensure its integrity and
consistency. They are used to enforce business rules, prevent invalid data from being entered, and
maintain data accuracy and reliability. Some constraints are -

Primary Key - Unique values, Null not allowed


Unique - Unique values, Null Allowed
Not Null - Must Contain Some Value
Foreign Key - Dependency on other table
Primary Key

A primary key is a unique identifier for each record in a table. It is used to ensure that each record
can be identified uniquely and to enforce data integrity.

It is used to ensure that each record can be identified uniquely and to enforce data integrity.

The primary key column must contain unique and non-null values.

Example - Class Roll no. , Unique Transaction no.


Foreign Key

A foreign key is a column or a set of columns in a relational database table that refers to the primary
key of another table.

It establishes a link between two tables, allowing data to be retrieved from both tables
simultaneously.

You might also like