⚡ 180+ new openings posted today

SQL in One Shot: A Beginner’s Guide

What is SQL Query Language ?

Answer : Full Form of SQL (Structured Query Language). SQL is a query language used to store, retrieve, and manipulate data in databases.

Database : Means Store Data in Structured Format (Rows & Columns).

For example, we have an Employees database. In the Employees database, we have a table that contains multiple rows and columns.

For example, an Employees table can contain 3 records:

Employee_IDEmployee_NameSalary
101Rahul10,000
102Priya20,000

We have 3 columns (Employee_IDEmployee_NameSalary) and 2 rows (records).

What is CRUD Operation ?

Answer : CRUD stands for Create, Read, Update, and Delete. These are the 4 operations performed on data in a database.

C -> CREATE (For Example : Add a New Employees Record)

R -> READ (For Example : Retrieve the Employees Information)

U-> UPDATE (For Example : Modify Existing Information of Employees)

D -> Delete (For Example : Remove an Employee Record).

What are the different types of SQL commands / How many types of SQL commands are there, and what are they?

Answer : SQL commands are generally divided into 5 categories.

  1. DQL : (Data Query Language) – Example (SELECT).
  2. DDL : (Data Definition Language) – Example (CREATE , ALTER , DROP , TRUNCATE).
  3. DML :(Data Manipulation Language) – Example (INSERT , UPDATE , DELETE)
  4. DCL : (Data Control Language) – Example (GRANT , REVOKE)
  5. TCL : (Transaction Control Language) -Example (COMMIT, ROLLBACK , SAVEPOINT)

What is the difference between SQL and NoSQL databases ?

Answer : These are the 5 key differences between SQL and NoSQL databases.

Relational DatabaseNon Relational Database.
SQL DatabaseNoSQL Database
Data Stored in Tables (Row & Column)Data stored are either key-value pairs, document-based, graph databases
They have Predefined Schema (Fixed or Static)They have dynamic Schema
Example : PostgreSQL, MySQL, MS SQL ServerEg: MongoDB, Cassandra, Hbase

What are Data Types in SQL ?

Answer : Commonly Used Data Types in SQL

  1. int : Used to store(Whole Number) Values. Example (200 , 500 , 1000)
  2. float : Used to Specify the decimal point number. Example (10.5 , 99.99)
  3. Bool/ Boolean : used to specify Boolean values true and false.
  4. char : fixed length string that can contain numbers, letters, and special characters Example: CHAR(10)
  5. varchar : variable length string that can contain numbers, letters, and special characters. Example: VARCHAR(100)
  6. date : Used to store date. Displayed format is YYYY-MM-DD. Example: 2026-08-22
  7. datetime : Used to store both date and time. Displayed format is YYY-MM-DD HH:MM:SS Example: 2026-08-22 17:30:00

Note: Exact data types can vary between database systems.

What is a Table ?

Answer : A table is a database object used to store data in the form of rows and columns.

Employee_IDEmployee_NameSalary
101Rahul10,000
102Priya20,000

What is a row in Table ?

Answer : Row Represents a single record in a table.

What are ACID Properties ?

Answer : To Ensure the integrity of the database, there are a set of principles that ensure database transaction are processed reliably and safely.

ACID Stands for

A : Atomicity : (Either all Operations of the transactions are Completed Successfully or none of them are applied). For Example: Rahul sends ₹1,000 to Priya’s account. After the transaction, Rahul’s balance becomes ₹0 and Priya’s balance becomes ₹1,000. If the transaction fails at any point in between, the entire transaction should be rolled back, and the original balances should be restored. This is called Atomicity.

C : Consistency : (The transaction must take the database from one valid state to another valid state).

Example

Suppose Rahul has ₹1,000 and wants to send ₹500 to Priya.

Before the transaction:

AccountBalance
Rahul₹1,000
Priya₹500

After the transaction:

AccountBalance
Rahul₹500
Priya₹1,000

The total balance remains ₹1,500 before and after the transaction. If the transaction fails to send the money to Priya’s account, then the data becomes inconsistent.

I : Isolation : (Isolation means all transactions run independently, and one transaction will not affect another transaction.) For example, two people transferring money at the same time should not cause incorrect account balances.

D : Durability : Durability ensures that once a transaction is committed, its changes are permanently saved, even if the system fails. For Example : Once a Transaction is Successfully committed, the changes should remain saved even if the database system crashes afterwards.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top