Database Systems

A database is a logically coherent collection of data that has some inherent meaning. A database management system(DBMS) is a software that is used to define, construct and manipulate and share databases.

Relation

A relation is just a set of tuples. We often call these tuples, rows.

Schema

A schema is the description of the data in a database in terms of the data model. A schema is sometimes called the intension of a database, and the database state is called the extension of this schema.
A schema could look like

Physical schema

A physical schema describes how data is to be represented and stored in secondary storage using a particular DBMS. In simpler words, it deals with the physical aspect of where the date is being stored, like the hardware, data structures, disk partitions and indexes.

Conceptual schema

A conceptual schema is a high level description of the information being stored in a database. It only includes the main concepts and the main relationships between them and is often insufficient to build an actual database. This is usually what we think of when we say 'schema' in DBMS.

External schema

An external schema is a more refined form of the conceptual schema. It is authorized and customized to be accessed by a group of users or individual users. Every database has one conceptual and one physical schema but it may have many external schemas. Essentially it describes, who can look at what in a database..

View

A view is conceptually the same as a relation, but the records (tuples or rows) in it are not stored directly in the database and are computed from other relations.

Data independence

It is defined as the ability to change the schema at one level without having to change some other schema at a higher level. In a data independent DBMS, when a schema is changed, only the mappings in higher level schemas have to be changed. The schemas themselves at the higher level should still remain unchanged.

Logical data independence

It refers to the ability of being able to modify the conceptual schema while keeping the external schema unchanged. The users of the application remain unaffected.

Physical data independence

It is the ability to be able to change the physical storage and aspects without affecting the conceptual schema of the database, and therefore the applications that depend on it.

Transaction

A transaction is a set of operations that are indivisible (smallest unit of commands) that a user wants to perform.

Database state

The data in a database at a particular moment in time is called the database state or snapshot. It is also called the current set of occurances or instances in the database.

Database management system

A database management system is a software that facilitates defining, constructing, manipulating and sharing a database. DBMS often provide tools for data recovery, backup and performance tuning.

Characteristics

  • Self describing
  • Insulation between programs and data
  • Support multiple user views
  • Sharing of data
  • Multi user transactions
  • Security and low redundancy
  • Follows ACID (Atomicity, Consistency, Isolation and Durability)

Disadvantages

  • Cost of software and hardware is quite high
  • People who work on the DBMS will have to be trained since the system is complex

Architecture

The goal of any database architecture is to seperate user applications from the physical database, using multiple levels to seperate data. Requests have to pass through these levels.
The processes of transforming requests and results between levels are called mappings. Mappings create an abstraction, so that users can interact with the database at a high level without worrying about the inner workings and structure.

Three schema architecture

The three schema architecture consists of three major levels that will be discussed below. The DBMS that follows this architecture must transform a request specified on an external schema into a request at the conceptual level, which again is transformed into a request at the physical level and processed.

External level

It is also called the view level, since it provides only part of the database that a specific user group is interested in, while hiding the rest of the database from that group. Multiple views are possible for the same database, with attributes that might not be present in the main database (like a view could show you the age, that is calculated from the date of birth in the database).

Conceptual level

This level hides the physical storage specific details and focuses on describing the actual entities, data types, relationships and constraints in the database. This level is used by the DBA to decide what information should be stored in the database.

Internal level

The internel level is also called the physical level since it uses a physical data model. It describes how the data is actually stored on the lowest level. It describes data storage and access methods. A DBA might be aware of certain details on the physical organization of the data.

Database normalization

Normalization is the process in which we organize data to reduce redundancy and increase data integrity.