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

Lesson 1

The document outlines key concepts in databases, including the differences between data and information, the role of information systems, and the necessity of databases for data organization and analysis. It discusses database transactions, the importance of ACID properties, and issues related to concurrency. Additionally, it covers data validation and verification processes to ensure data integrity and accuracy.

Uploaded by

Mehabunnisa
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Lesson 1

The document outlines key concepts in databases, including the differences between data and information, the role of information systems, and the necessity of databases for data organization and analysis. It discusses database transactions, the importance of ACID properties, and issues related to concurrency. Additionally, it covers data validation and verification processes to ensure data integrity and accuracy.

Uploaded by

Mehabunnisa
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Option A - Databases

LESSON 1

Unit # - Unit Name Computer Science - IB


A.1
Assessment statement
Outline the differences between data and information.
Outline the differences between an information system and a database.
Discuss the need for databases.
Describe the use of transactions, states and updates to maintain data consistency (and integrity).

Assessment statement
Define the term database transaction.
Explain concurrency in a data sharing situation.
Explain the importance of the ACID properties of a database transaction.
Describe the two functions databases require to be performed on them.
Explain the role of data validation and data verification.

Unit # - Unit Name Computer Science - IB


Data vs Information
You might remember this from IGCSE

Data is meaningless. To be useful, data must be interpreted


to produce information.
Data is raw facts
Information has meaning

Unit # - Unit Name Computer Science - IB


Unit # - Unit Name Computer Science - IB
Information system vs a database.
An information System
A combination of hardware, software,
infrastructure and trained personnel organized
to facilitate planning, control, coordination,
and decision making in an organization.

A database
A specific part of an information system could
be a database.

Unit # - Unit Name Computer Science - IB


Why do we need databases
To store data
In a logical/organised manner
Allowing data analysis

Unit # - Unit Name Computer Science - IB


Transactions
Database actions are made up of transactions and operations.

An operation is a single minimal function that a database can


complete - a query, update, delete etc

A transaction may consist of several operations such as deleting


a customer might require a query, an authentication, and then
the deletion.

Unit # - Unit Name Computer Science - IB


Unit # - Unit Name Computer Science - IB
Unit # - Unit Name Computer Science - IB
Transactions: Consistency and Integrity
▪To ensure data consistency when moving money between two
accounts it is necessary to complete two operations (debiting one
account and crediting the other).

▪Unless both operations are carried out successfully, the transaction


will be rolled back.

▪A roll back is when the database is returned to the state prior to the
transaction

Unit # - Unit Name Computer Science - IB


What is a transaction
▪The minimal step of operation/update to be performed on a database;
▪That guarantees consistency/integrity of the database;
▪And recovery upon failure;

For example:
▪Minimal set of actions that complete/make the booking;
▪So that database is accurate/consistent/has integrity;
▪So that database is updated to prevent others booking room;
▪So that recovery can be run on failure;

Unit # - Unit Name Computer Science - IB


Concurrency
▪Concurrency is the ability of a database to allow multiple users to affect
multiple transactions.
▪This is one of the main properties that separates a database from other
forms of data storage like spreadsheets.
▪The ability to offer concurrency is unique to databases. Spreadsheets or
other flat file means of storage are often compared to databases, but they
differ in this one important regard.
▪Spreadsheets cannot offer several users the ability to view and work on the
different data in the same file, because once the first user opens the file it is
locked to other users. Other users can read the file, but may not edit data.

Unit # - Unit Name Computer Science - IB


Issues with concurrency
There are 3 core issues that may arise with concurrency:
1. The lost update problem;
This problem occurs (for example) when two operations, accessing the same items, have their
operations interleaved in a way that makes the value of some items incorrect;
2. The temporary update problem;
This problem occurs when one transaction updates a database item and then the transaction fails
for some reason. Meanwhile the updated item is accessed by another transaction before it is
changed back to its original value;
3. The incorrect summary problem;
If one transaction is calculating an aggregate of term grades/summary function on a number of
database items while other transactions are updating these items, the aggregate function may
calculate some values before they are updated and others after they are updated;

Unit # - Unit Name Computer Science - IB


ACID

Unit # - Unit Name Computer Science - IB


ACID - properties of a database
transaction
Atomicity
Atomicity requires that each transaction be
"all or nothing": if one part of the transaction
fails, then the entire transaction fails, and the
database state is left unchanged.
An atomic system must guarantee atomicity
in each and every situation, including power
failures, errors and crashes. To the outside
world, a committed transaction appears (by
its effects on the database) to be indivisible
("atomic"), and an aborted transaction does
not happen.

Unit # - Unit Name Computer Science - IB


ACID - properties of a database
transaction
Consistency
The consistency property ensures that any transaction
will bring the database from one valid state to another.
Any data written to the database must be valid
according to all defined rules,
including constraints, cascades, triggers, and any
combination thereof.
This does not guarantee correctness of the transaction
in all ways the application programmer might have
wanted (that is the responsibility of application-level
code), but merely that any programming errors cannot
result in the violation of any defined rules.
If the database was in a consistent state before the
execution of a transaction, it must remain consistent
after the execution of the transaction as well.
Unit # - Unit Name Computer Science - IB
ACID
Isolation
The isolation property ensures that the concurrent execution of transactions results in a system state that would be obtained if
transactions were executed sequentially, i.e., one after the other. Providing isolation is the main goal of concurrency control.
Depending on the concurrency control method (i.e., if it uses strict - as opposed to relaxed - serializability), the effects of an
incomplete transaction might not even be visible to another transaction. No transaction will affect the existence of any other
transaction.
Durability
The durability property ensures that once a transaction has been committed, it will remain so, even in the event of power
loss, crashes, or errors. In a relational database, for instance, once a group of SQL statements execute, the results need to be
stored permanently (even if the database crashes immediately thereafter).
To defend against power loss, transactions (or their effects) must be recorded in a non-volatile memory. If a transaction
commits but the system fails before the data could be written on to the disk, then that data will be updated once the system
springs back into action.

Unit # - Unit Name Computer Science - IB


The two functions of a database
Query functions (n.) A query is a request for information from a database.
There are three general methods for posing queries:
Choosing parameters from a menu: In this method,
the database system presents a list of parameters from
which you can choose. This is perhaps the easiest way to
Update functions. pose a query because the menus guide you, but it is also
the least flexible.
Query by example (QBE): In this method,
the system presents a blank record and lets you specify
An Update Query is an action query (SQL the fields and values that define the query.
statement) that changes a set of records
Query language: Many database systems require you to
according to criteria (search conditions) you make requests for information in the form of a stylized
specify. It's a very powerful feature and a query that must be written in a special query language.
fundamental part of relational databases This is the most complex method because it forces you
to learn a specialized language, but it is also the most
since you can modify a huge number of powerful. E.g SQL
records at one time.

Unit # - Unit Name Computer Science - IB


Data Validation and Data Verification.
▪ Data verification is a way of ensuring the user types in what he or she
intends, in other words, to make sure the user does not make a mistake
when inputting data. An example of this includes double entry of data (such
as when creating a password or email) to prevent incorrect data input.

▪ Data validation has nothing to do with what the user wants to input.
Validation is about checking the input data to ensure it conforms with the
data requirements of the system to avoid data errors. An example of this is
a range check to avoid an input number that is greater/smaller than the
specified range.

Unit # - Unit Name Computer Science - IB

You might also like