IT
IT
BASICS OF DATABASES
Database
Is a formally structured set of information that pertains to a particular subject or
purpose, stored by a computer program.
It allows you to input data, organize the data, and retrieve the data quickly.
Traditional Database
Are organized by fields, records and files
A Database Provides a:
Database Query
- Is an inquiry into the database that returns information back from the
database.
- It is used to ask for information from a database.
Database Index
- Is a data structure that improves the speed of data retrieval operations on
a database table.
Transaction
Is a single operation or a series of operations that retrieves or alters the data in
a database.
2 Results of Transaction:
1. Committed (Commit)
If a transaction finishes successfully, the results of the transaction are
written to the database (committed) and the end result is that the
database attains a new consistent state.
2. Rolled Back (Rollback)
If there is a problem with the transaction and it does not complete
successfully, it will be aborted and the uncommitted data changes will
need to revert back to their original values.
b. ACID
- Acronym for the 4 properties that are desirable for any effective
transaction system.
Atomicity – Transaction is a complete unit, and is executed in its entirety or
not at all.
Consistency – Transaction must change the database from one consistent
state to another consistent state. If an operation within the transaction would
violate the database’s rules, the transaction is rolled back.
Isolation – Transaction is independent from other transactions. That is, while
a transaction is in progress, no one else can see the data being affected, as
this data may be in an inconsistent state until the transaction is completed.
Durability – Committed transactions are permanent and will not be lost if
the power fails or if the database restarts. Once a transaction has been
committed, it cannot be rolled back. The only way to undo a committed
transaction is to execute another transaction that reverses the changes
made by the first transaction.
c. Security
- Database security is accomplished through a combination of physical,
network access and design methods.
- Is a set of practices and policies that protect a database from
unauthorized access, manipulation, or destruction.
DATABASE FILES
Microsoft SQL server uses three types of files to store the database:
Primary Data Files – Has a .mdf extension which contain user-defined objects,
such as tables
and views, as well as system tables.
Secondary Data Files – Has a .ndf extension, on separate physical hard disks
to give your
database more room.
Transaction Log Files – Use a .ldf extension and don’t contain any objects
such as tables or
views.
Advantages of DBMS
Controlling of Redundancy
Improved Data Sharing
Data Integrity
Security
Data Consistency
Efficient Data Access
Enforcements of Standards
Reduced Application Development and Maintenance Time
Disadvantages of DBMS
It is bit complex
It uses large amount of memory. It also needs large memory to run efficiently.
DBMS system works on the centralized system, i.e.; all the users from all over
the world access this database
DBMS is generalized software, i.e.; it is written work on the entire systems
rather specific one.
The IBM Information Management System (IMS) and Windows Registry are
famous examples of hierarchical databases.
2. Network Database
Use a network structure to create a relationship between entities.
Are mainly used on large digital computers.
3. Relational Databases
Is a collection of information that organizes data in predefined relationships
where data is stored in one or more tables (or “relations”) of columns and
rows
4. Object-Oriented Model Database
Data is stored in the form of objects. This model is used to represent real-
world entities.
Data and their relationships are contained in a single structure which is
referred as object in this data model.
5. Graph databases
Is a database that uses graph structures for storing data.
It uses nodes, edges, and properties instead of tables or documents to
represent and store data. The edges represent relationships between the
nodes.
6. ER model databases
The Entity Relationship Model is a model for identifying entities (like student,
car or company) to be represented in the database and representation of
how those entities are related.
The ER data model specifies enterprise schema that represents the overall
logical structure of a database graphically.
7. Document databases
A type of database that stores data as documents, usually in JSON or BSON
format.
Data is stored in documents rather than tables or graphs, so it becomes easy
to map things in many programming languages.
CHAPTER 4: DATA MANAGEMENT AND DATABASE APPLICATIONS
4.2. Data Organization and Relational Database Concepts