Home » Oracle SQL » What is a Database? Introduction to Oracle SQL and MySQL

What is a Database? Introduction to Oracle SQL and MySQL


Before we begin learning SQL, let’s understand some fundamental concepts and key terms:

What is Data?

Data is the lifeline of any business that exists today. It can be represented as a collection of facts or information related to an object. For example, your identity card contains data related to you. Similarly, for a business any information needed for its operations can be considered useful data related to that business. This data can be stored and later analyzed to gain better understanding of business and to improve it.

PDF files, images, videos, spreadsheets are also examples of data.

What is a Database?

If we group related data in a structured and organized manner we get a database. Contact books and Address books are some basic examples of databases.

Data is stored systematically in a database so that it can be quickly retrieved and managed when needed.

Difference between a Database and Spreadsheet

Both Databases and Spreadsheets are used for storing information, but there are certain limitations when it comes working with spreadsheets. Spreadsheets become unusable with large volumes of datasets which includes millions of records while databases are designed for storing and handling large datasets.

Spreadsheets are good for small datasets, calculations, charts, data and statistical analysis.

Databases are a much better alternative when it comes to handling multiple users, complex search queries, data management and analysis, storing repetitive and large volumes of data.

What is SQL?

SQL is the short form of “Structured Query Language” which is a standard coding language for interacting with relational databases. It is pronounced as “See-quel” or even “S-Q-L”. Both ways are correct.

It is relatively easy to learn and does not take much time to master the concepts. SQL consists of commands which can be used to perform basic operations like Insert, Update, Retrieve and Delete on a set of records.

SQL is further divided into:

  1. Data Definition Language (DDL) – Creating, replacing, altering, dropping objects
  2. Data Manipulation Language (DML) – Inserting, updating, deleting rows in a table
  3. Data Retrieval Language (DRL) – Querying data from the table
  4. Transaction Control Language (TCL) – Controlling transactions
  5. Data Control Language (DCL) – Controlling access to the database and its objects

There are different versions of SQL available used for interacting with Databases created by different companies. But since SQL is an ANSI (American National Standards Institute) standard language, one can easily switch from one to other as almost all are same.

Types of Databases

Free Databases: MySQL owned by Oracle, SQL Lite, Maria DB

Commercial: Oracle, Teradata, IBM DB2

What is a DBMS?

DBMS stands for Database Management Systems. If database is a set of data then DBMS is a software which enables users to store and manage that data electronically.

DBMS allows multiple user access and is designed to fulfill the needs of small and large businesses. It is easy to execute complicated transactions using DBMS.

Database and DBMS are sometimes used interchangeably but more often than not, they refer to DBMS which comprises of the entire (software)system and not just database.

Four Types of DBMS systems are:

  • Hierarchical( Navigational) database
  • Network database
  • Relational database
  • Object-Oriented database
  • Hierarchical DBMS

This is one of the earlier forms of DBMS which is rarely used these days. In this, data is represented through a parent-child relationship and is arranged in a tree-like structure. In this structure, one parent can have multiple children but each children has just one parent.

Network DBMS

This is a more complex model in which each child can have multiple parents within the structure. It allows to represent complex relationships like parts or orders where each entity can be related to many entities. These model supports many-to-many relationships.

Relational DBMS

This is the most widely used DBMS as data is represented in the form of tables which are related to each other. For example, salary data of employee can represented in one table while the personal information of employee like address, date of joining, job location etc. can represented in other table. Employee ID is the common column which is shared by both tables.

Some of the notable examples of Relational DBMS are as follows:

  • DB2 from IBM.
  • Oracle SQL – Has the highest share in RDBMS space
  • SQL Server from Microsoft.
  • MySQL – Popular free and open-source database, which was also bought by Oracle

Object Oriented DBMS

This DBMS is popular for storing new data types. This DBMS model consists of data stored in the form of objects which have certain attributes and operations associated with it. Example: PostgreSQL

Difference between Oracle SQL and MySQL

Oracle is the most popular database management system in the market today and it was released by Oracle Corporation in 1979. While MySQL was initially owned and sponsored by a Swedish company named MySQL AB, but it was also acquired by Oracle in 2010. Both Oracle SQL and MySQL are the most popular relational DBMS we have in the market today.

MySQL:

  1. Free and open source relational database management system.
  2. It does not offer as much tools for Enterprises as Oracle SQL does.
  3. MySQL database does not support XML.
  4. It supports only two character types which are CHAR and VARCHAR.
  5. It is still widely used by web-based applications like WordPress, Drupal, Joomla as it is part of LAMP ( Linux, Apache, MySQL, PHP) Stack.
  6. Many other sites like Facebook and Youtube also use it as it offers a lot of functionality despite being free.

Oracle SQL

Oracle is much more advanced and powerful than MySQL in solving majority of data problems. This is the reason it is the mostly used by enterprises for managing their data.

Oracle offers three versions of databases:

  1. Enterprise Edition – Paid version which offers all the premium features ( Most used by enterprises)
  2. Standard Edition – Limited version of Enterprise Edition
  3. Express Edition – Free Version with very limited features.

If you are looking for a free option than MySQL is a better alternative than free version of Oracle as it offers a lot more features. Express Edition of Oracle Database is mostly used by students who want to learn Oracle.

Some Basic concepts while working with relational databases

What is a table?

In any relational database management system, the data is stored in database objects called tables. We can record entries in the form of rows and columns in these tables.

What is a field?

Every table is broken up into smaller individual elements called fields.

What is a column?

A column is collection of cells aligned vertically in a table.

What is a Record or a Row?

A record or row is collection of cells aligned horizontally in a table.

How to start using Oracle Database?

Step 1 – Install Oracle Database

Step 2 -Install SQL Developer

Working tools used with SQL:

Once we install Oracle Database on our computer we can interact with the database using these tools.

  1. SQL * PLUS

SQL PLUS is the command line interface which we can use to connect with Oracle database Server. We can either use Windows/Linux terminal to launch SQL PLUS by typing sqlplus and pressing enter or we can directly click on SQL PLUS in programs menu.

SQL Plus Command Line Tool

We use SQL PLUS to write SQL queries manually and make changes to the Oracle database.

  1. SQL Developer

This is a third party tool that we need to install separately to interact with Oracle database server. It offers a GUI ( Graphical User Interface) where we can perform usual tasks like creating or deleting a table without writing a line of code.

SQL Developer Tool

SQL developer allows us to manipulate the database either using GUI interface or by writing SQL queries yourself.

SQL PLUS is generally faster but SQL developer is a lot more beginner friendly, we will be using SQL developer while working with Oracle in this series