BDAT1000-Week 2 019
BDAT1000-Week 2 019
PROBLEM
2
PROBLEM
3
POSSIBLE SOLUTIONS
• Paper based
• Database
4
PROBLEM WITH PAPER BASED SYSTEMS
• Wasted Physical space
• Duplicate data
5
PROBLEM WITH (LOCAL) ELECTRONIC FILE-BASED SYSTEMS
• Less secure
• Data Sharing
• Duplicate Data
6
PROBLEM WITH (ONLINE) ELECTRONIC FILE-BASED SYSTEMS
• Less secure
• Data Sharing
• Duplicate Data
7
SOLUTION – RDBMS SYSTEM
• Database is a collection or group of related data (tables)
• 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
8
RDBMS SYSTEM
9
WHY USE DATABASE SYSTEM
• Separation of data definition and the program
10
DBMS ≠ DATABASE
• A database system is a collection of your data stored in a computer
11
DATA ABSTRACTION
• The process of hiding irrelevant details from users
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
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
• Makes data secure and flexible by eliminating redundancy and inconsistent dependency
• 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)
23
NORMALIZATION – FIRST NORMAL FORM
• Eliminate repeating groups in individual tables
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
25
NORMALIZATION – THIRD NORMAL FORM
• It is in the Second Normal form
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
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
31
SOFTWARE INSTALLATION
• SQL Server Management Studio (SSMS)
32
APPROACHES
• Visual Studio
• SSMS
• Query
33
DATA TYPES
34
SQL
• String Data types:
1. CHAR(size) : Fixed string length
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
37
WORKING WITH
DATABASE
38
SQL
• Create Database: CREATE DATABASE databasename;
39
SQL
• SQL
• Visual Studio
• SSMS
40
THANK YOU