codingstuff.io
ExploreTutorialsProblemsCS Subjects
Get Started
ExploreTutorialsProblemsCS Subjects
Get Started
codingstuff.io

Master the art of building software through interactive tutorials, real-world problems, and guided projects.

Pune, Maharashtra, India

codingstuffmail@gmail.com

Product

  • Explore
  • Tutorials
  • Problems
  • CS Subjects

Company

  • About
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Sitemap

© 2026 codingstuff.io. All rights reserved.

Built with ❤️ for developers everywhere

/
/
All Tutorials
🗄️

SQL & Databases

5 / 67 topics
1Introduction to Databases2Types of Databases3Overview of SQL4Installing a SQL Database5Database Terminology
Tutorials/SQL & Databases/Database Terminology
🗄️SQL & Databases

Database Terminology

Updated 2026-04-20
5 min read

Introduction

Databases are fundamental components of modern software systems, enabling efficient data storage, retrieval, and management. Understanding database terminology is crucial for anyone working with databases, whether you're a developer, data analyst, or IT professional. This tutorial provides an in-depth look at key terms and concepts related to databases, using SQL as the primary language for examples.

What is a Database?

A database is a structured collection of data organized in a way that allows efficient retrieval and management. Databases can be categorized into several types based on their structure and usage:

  • Relational Databases: Store data in tables with predefined relationships between them. SQL (Structured Query Language) is the standard language for managing relational databases.
  • NoSQL Databases: Designed to handle unstructured or semi-structured data, NoSQL databases come in various forms such as key-value stores, document stores, and graph databases.

Tables

A table is a fundamental component of a relational database. It consists of rows and columns where each row represents a record, and each column represents an attribute of the record. For example:

CREATE TABLE Employees (
    EmployeeID INT PRIMARY KEY,
    FirstName VARCHAR(50),
    LastName VARCHAR(50),
    Department VARCHAR(50)
);

Columns

Columns in a table represent the attributes or fields of the data. Each column has a name and a data type, such as INT, VARCHAR, etc.

  • Primary Key: A unique identifier for each row in a table.
  • Foreign Key: A field that creates a link between two tables.

Rows

Rows represent individual records or entries within a table. Each row contains values corresponding to the columns defined in the table.

Data Types

Data types define the type of data that can be stored in a column. Common SQL data types include:

  • INT: Integer numbers.
  • VARCHAR(n): Variable-length character strings with a maximum length of n.
  • DATE: Date values.
  • FLOAT: Floating-point numbers.

Indexes

An index is a data structure that improves the speed of data retrieval operations on a database table at the cost of additional writes and storage space to maintain the index data structure. For example:

CREATE INDEX idx_lastname ON Employees(LastName);

Indexes are particularly useful for columns that are frequently used in WHERE clauses or as part of a join condition.

Primary Key

A primary key is a unique identifier for each row in a table. It ensures that no two rows have the same value and cannot be NULL. For example:

CREATE TABLE Employees (
    EmployeeID INT PRIMARY KEY,
    FirstName VARCHAR(50),
    LastName VARCHAR(50)
);

Foreign Key

A foreign key is a column in one table that references the primary key of another table, establishing a relationship between them. This ensures referential integrity and helps maintain data consistency across tables.

CREATE TABLE Orders (
    OrderID INT PRIMARY KEY,
    EmployeeID INT,
    FOREIGN KEY (EmployeeID) REFERENCES Employees(EmployeeID)
);

Joins

A join is an operation that combines rows from two or more tables based on a related column between them. Common types of joins include:

  • INNER JOIN: Returns records that have matching values in both tables.
  • LEFT JOIN: Returns all records from the left table, and the matched records from the right table. If there is no match, the result is NULL on the side of the right table.
SELECT Employees.FirstName, Employees.LastName, Orders.OrderID
FROM Employees
INNER JOIN Orders ON Employees.EmployeeID = Orders.EmployeeID;

Normalization

Normalization is a process used in database design to reduce redundancy and improve data integrity. It involves organizing the fields and tables of a relational database to minimize dependency and redundancy.

First Normal Form (1NF)

  • Each table cell contains atomic values.
  • No repeating groups are allowed.

Second Normal Form (2NF)

  • Meets all requirements of 1NF.
  • All non-key attributes must be fully functionally dependent on the primary key.

Third Normal Form (3NF)

  • Meets all requirements of 2NF.
  • Non-key attributes cannot depend on other non-key attributes.

Transactions

A transaction is a sequence of SQL statements that are executed as a single unit of work. It ensures data integrity by either completely executing or rolling back all operations if an error occurs.

BEGIN TRANSACTION;
UPDATE Employees SET Salary = 50000 WHERE EmployeeID = 1;
INSERT INTO Orders (OrderID, EmployeeID) VALUES (101, 1);
COMMIT;

ACID Properties

ACID properties are a set of characteristics that guarantee the reliable execution of database transactions. They include:

  • Atomicity: A transaction is an all-or-nothing operation; it either completes successfully or fails entirely.
  • Consistency: A transaction brings the database from one valid state to another, preserving invariants.
  • Isolation: Transactions do not interfere with each other. Each transaction executes independently of others.
  • Durability: Once a transaction has been committed, it will remain so, even in the event of power loss or system failure.

Views

A view is a virtual table based on the result-set of a SQL query. It provides a way to simplify complex queries and restrict access to certain data.

CREATE VIEW EmployeeDetails AS
SELECT FirstName, LastName, Department
FROM Employees;

Stored Procedures

A stored procedure is a precompiled collection of SQL statements stored in the database. They can be executed by name and are useful for encapsulating business logic.

DELIMITER //
CREATE PROCEDURE GetEmployeeDetails(IN empID INT)
BEGIN
    SELECT FirstName, LastName, Department
    FROM Employees
    WHERE EmployeeID = empID;
END //
DELIMITER ;

Triggers

A trigger is a special type of stored procedure that automatically executes in response to certain events on a particular table or view. For example:

CREATE TRIGGER UpdateLastLogin
AFTER UPDATE ON Users
FOR EACH ROW
BEGIN
    UPDATE Users SET LastLogin = NOW() WHERE UserID = NEW.UserID;
END;

Best Practices

  • Use Indexes judiciously: While indexes improve read performance, they can slow down write operations. Balance their use based on query patterns.
  • Normalize your database: Proper normalization helps reduce redundancy and improves data integrity.
  • Handle transactions carefully: Ensure that critical operations are wrapped in transactions to maintain data consistency.
  • Secure your databases: Implement strong access controls and encryption to protect sensitive data.

Conclusion

Understanding database terminology is essential for effective database management. By mastering concepts such as tables, indexes, joins, and normalization, you can design efficient and reliable database systems. This tutorial provides a solid foundation for further exploration into SQL and database management.


PreviousInstalling a SQL DatabaseNext Creating a Database

Recommended Gear

Installing a SQL DatabaseCreating a Database