Understanding Databases

Understanding Databases

Hello there, I am Aman and in this article, I aim to give you a brief introduction to databases, what they are, why we use them, what are the types of databases, etc. I assume you are just a beginner and want to get a headstart in the right direction. I generally like to divide my articles (if it's about a tech) into levels to ease things for readers. If, at any point, you feel that things are getting a bit messy, just go through once again because I'm making a promise that I've written this article keeping a lot of things in mind and I want this article to be a cakewalk for you. Cheers!

LEVEL 1 :

What is a Database?

The term database started to pop up in the 1960s when people started to use the disk and drum storage services (random access storage devices). Later on, with increasing needs and technological advancements, computers had more capacity and started being commonly available. These events simply meant that there was more data to deal with.

Good to know -

A group that was leading the standardization of the Common Business Oriented Language (COBOL) computer programming language proposed a database approach that was referred to as Conference on Data Systems Language (CODASYL). In this approach, the data was managed in a navigational structure.

Getting more specific, a Database is an organized collection of data. Data in a database can be stored in various patterns -

  • Data is stored in pre-defined tables connected by common data elements (Relational Databases).
  • Data is stored in lists or parent/child like paths (Hierarchical Databases).

Database Management Systems (DBMS) -

DBMS just provide an interface to manage the data stored and facilitate access to the data. The name of the management system is used to refer to the database. Some common DBMSs (or Database) are PostgreSQL, MySQL, MongoDB, MariaDB, etc. It's really difficult to tell the best DBMS out of the lot as which DBMS to use is simply the choice of the organization depending on their needs. Getting into details of the popular available DBMSs is beyond the scope of this introductory article but we can just go through some of the DBMSs and their features superficially.

  • Oracle RDBMS -

Has support for "enterprise editions", robustly managed, takes less space

  • IBM DB2 -

Can handle complex languages, easy to install

  • MongoDB -

Open source, solid documentation

  • MariaDB -

Freely available, open source

And that is it for Level 1. Cui bono ;)

Now, Level 2 is about going into details about what we have already touched in Level 1 and just one new topic, the SQL language.

LEVEL 2:

Relational Databases -

The below-mentioned points can give you a good idea of what Relational databases are all about-

  • Data is organized into tables.
  • A common data element is used to link the tables.
  • We can always create new tables, delete older ones, and edit existing ones.

The navigational databases used the "go-to" methodology which was very unorganized and lacked search abilities which meant there was a need for a newer approach and the answer to this problem were Relational Databases.

Good to know - E.F Codd published the original research paper titled "A Relational Model of Data for Large Shared Data Banks".

An example of a relational database with three tables.

relational_img.png

Hierarchical/Navigational Databases -

Since we have already discussed relational databases in detail, you may have a clear picture of the unorganized nature of hierarchical databases and their shortcomings. These databases formed a large network of data using linked lists called data sets. These data sets had forward and reverse pointers to other members in the data set and the data can be stored using one of the various available methods -

  • Navigating a set of data.
  • A primary key, using a hashing algorithm.​
  • Sequentially scanning the records/data.

Back in the time, there were two major leaders in the marketplace

  • Cincom Systems and its TOTAL database.
  • IBM, with its Information Management System or IMS.

Structured Query Language (SQL) -

Structured Query Language (SQL) is one of the first computer languages to be used to access relational databases & supported queries, insertion & deletion of data. The American National Standards Institute (ANSI) made it the standard in 1986. You can go through the below example but remember the main aim of this article is to get you familiar with Databases and the basic terminology and not to make you an expert. So, if you don't exactly understand what's going on in the below code snippets, it's just completely fine.

Adding a table -

CREATE TABLE Countries(
    -> Countryno INT NOT NULL ,
    -> Countryname VARCHAR(100) NOT NULL,
    -> Description Countryname(200),
    -> PRIMARY KEY ( Countryno )
    -> );

Selecting information from table -

Select * FROM Schools ;

Inserting data in a table -

INSERT INTO Schools(PinCode,City)
    -> Values (281004,'DPS'),
    -> (281004,'KMPS'),
    -> (281004,'LKPS');

Signing off :

The below points connect the dots of what we have discussed until now to make a clear picture for you.

  • Data is stored in tables of fixed lengths and we can always add/change/delete table columns.
  • Tables can be connected with each other using data elements and can be said to be in a relationship with each other.
  • RDBMS or Relational Database Management System takes the control of the management of tables and prevents the user from detailed manipulation of files.
  • SQL is used to request add, delete, query, etc. from the RDBMS.

That's it for now. Phew. I really hope you, by now have a good idea of what this article aimed at and hopefully, you were able to get that. Feel free to give me suggestions.

Byee!