0% found this document useful (0 votes)
13 views

BDAT1000-Week 2 019

Uploaded by

lovablehena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

BDAT1000-Week 2 019

Uploaded by

lovablehena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

DATA MANIPULATION TECHNIQUES

PROBLEM

2
PROBLEM

What are all the possible ways to store the


grades/marks of all the students?

3
POSSIBLE SOLUTIONS
• Paper based

• Local File e.g., Excel/Word etc.

• Online File e.g., Excel/Word etc.

• Database

4
PROBLEM WITH PAPER BASED SYSTEMS
• Wasted Physical space

• Searching is very difficult

• Data can be lost

• Duplicate data

5
PROBLEM WITH (LOCAL) ELECTRONIC FILE-BASED SYSTEMS
• Less secure

• Data Sharing

• Duplicate Data

• Might not be consistent

6
PROBLEM WITH (ONLINE) ELECTRONIC FILE-BASED SYSTEMS
• Less secure

• Data Sharing

• Duplicate Data

• Might not be consistent

7
SOLUTION – RDBMS SYSTEM
• Database is a collection or group of related data (tables)

RDBMS = Database + Set of programs :

• A Relational Database Management System is a collection of inter-related data and a set of programs to
manipulate it

• Database Management System stores data in such a way that it becomes easier to retrieve, manipulate, and
produce information

• It consist of various operation like storing, modify, remove, retrieve that data

• It also provide security or safety against system crashes

8
RDBMS SYSTEM

9
WHY USE DATABASE SYSTEM
• Separation of data definition and the program

• Abstraction into a simple model

• Data independence and efficient access

• Reduced application development time- ad-hoc queries

• Data integrity and security

• Uniform data administration

• Concurrent access, recovery from crashes

• Support for multiple different views

10
DBMS ≠ DATABASE
• A database system is a collection of your data stored in a computer

• A DBMS(DataBase Management System) is a software that manages databases

11
DATA ABSTRACTION
• The process of hiding irrelevant details from users

• View: Different users will have different data views

• Logical: How the data model is defined

• Physical: How the data is stored physically

12
ADVANTAGES OF RDBMS
• Easy to use: The Relational model in DBMS is easy as tables consisting of rows and columns are quite natural
and simple to understand

• Query capability: It makes possible for a high-level query language like SQL to query and filter the data.

• Data independence: The Structure of Relational database can be changed without having to change any
application.

• Scalable: Regarding several records, or rows, and the number of fields, a database should be enlarged to
enhance its usability.

13
ACID PROPERTIES

14
ACID PROPERTIES
These properties ensure the accuracy and integrity of the data in the database, ensuring that the data does not
become corrupt as a result of some failure, guaranteeing the validity of the data even when errors or failures occur.

• Atomicity: Either the entire transaction takes places at once or doesn't happen at all (All or nothing).

• Consistency: This ensures that you guarantee that all data will be consistent. All data will be valid according to
all defined rules, including any constraints, cascades, and triggers that have been applied on the database.

15
ACID PROPERTIES
• Isolation: Guarantees that all transactions will occur in isolation. No transaction will be affected by any other
transaction. So, a transaction cannot read data from any other transaction that has not yet completed.

• Durability: Once a transaction has completed. The updates to the database are written to the disk and they
resist even if a system failure occurs. These updates now become permanent and are stored in non-volatile
memory, the effects of the transaction, thus are never lost.

16
SQL

17
SQL
• SQL stands for Structured Query Language

• Designed to interact with data stored in a database

18
SQL "STANDARD"
• Each specific SQL implementation by a database vendor is called a dialect

• The vendors implement parts of the SQL standard (e.g., most implement SQL-92) but add their vendor- specific
extensions

• Most relational database vendors conform to a set of Core SQL features, but portability might still be limited
due to missing or additional features

19
DBMS VENDORS
• MSSQL

• Oracle

• MySQL etc.

20
NORMALIZATION

21
NORMALIZATION
• It is the process of organizing data in a database

• Includes creating tables and establishing relationships between those tables

• Makes data secure and flexible by eliminating redundancy and inconsistent dependency

• Redundant data wastes disk space and creates maintenance problems

• There are a few rules for database normalization. Each rule is called a "normal form." If the first rule is observed,
the database is said to be in "first normal form." If the first three rules are observed, the database is considered
to be in "third normal form." Although other levels of normalization are possible, third normal form is
considered the highest level necessary for most applications.

22
NORMALIZATION - TYPES
• First Normal Form (1NF)

• Second Normal Form (2NF)

• Third Normal Form (3NF)

23
NORMALIZATION – FIRST NORMAL FORM
• Eliminate repeating groups in individual tables

• Create a separate table for each set of related data

• Identify each set of related data with a primary key

• Do not use multiple fields in a single table to store similar data

24
NORMALIZATION – SECOND NORMAL FORM
• It should be in the First Normal form

• Create separate tables for sets of values that apply to multiple records

• Relate these tables with a foreign key

25
NORMALIZATION – THIRD NORMAL FORM
• It is in the Second Normal form

• Eliminate fields that do not depend on the key

26
NORMALIZATION – BEFORE
Student# Name Room Class1 Class2 Class3
1098 John A002 DM IES DP
1099 Shawn B005 DM IES DP

27
NORMALIZATION – AFTER
StudentID Name Room ClassID Class
1098 John A002 1 DM
1099 Shawn B005 2 IES
3 DP

RegistrationID StudentID ClassID


1 1098 1
2 1098 2
3 1098 3
4 1099 1
5 1099 2
6 1099 3

28
NORMALIZATION
• As with many formal rules and specifications, real world scenarios do not always allow for perfect compliance.

• In general, normalization requires additional tables, and some customers find this cumbersome.

• If you decide to violate one of the first three rules of normalization, make sure that your application anticipates
any problems that could occur, such as redundant data and inconsistent dependencies.

29
LAB

30
LAB

Georgian wants to build a database for all the


students to store their details. Produce a database
design that will be a better approach.

31
SOFTWARE INSTALLATION
• SQL Server Management Studio (SSMS)

• SQL Server (Developer or Express edition) / Visual Studio

32
APPROACHES
• Visual Studio

• SSMS

• Query

33
DATA TYPES

34
SQL
• String Data types:
1. CHAR(size) : Fixed string length

2. VARCHAR(size): Variable string length

3. TEXT: For storing very long text (2 Gb)

4. NCHAR, NVARCHAR, NTEXT

35
SQL
• Numeric Data types:
1. INT: Stores whole numbers

2. BIT: 0 or 1

36
SQL
• Date Data types:
1. DateTime: Stores data and time

2. Date: Stores just the date part

3. Time: Stores just the time part

37
WORKING WITH
DATABASE

38
SQL
• Create Database: CREATE DATABASE databasename;

• Drop Database: DROP DATABASE databasename;

39
SQL
• SQL

• Visual Studio

• SSMS

40
THANK YOU

You might also like