Doubtclip
TutorialsSimulationNEWFormulas
Dashboard
Refer+1
+1
Doubtclip

Your personal AI teacher for Physics, Chemistry & Maths — step-by-step solutions, follow-up doubts and whiteboard videos for JEE, NEET, CBSE, AP, IB & GCSE.

hello@doubtclip.com
QQuora SpaceQQuoraIInstagram
Featured on Traffiklist

Company

  • PricingVideos
  • Blog
  • Features
  • Refer & Earn+1
  • Feedback
  • Contact
  • For coaching

Practice

  • Practice hub
  • Question bank
  • JEE Main
  • NEET
  • Olympiad
  • Formula sheet
  • Chapter guides
  • Interactive Lab
  • My progress

Learn & tools

  • Mistake Doctor
  • Mistake Diary
  • Learn a topic
  • Topics explained
  • Homework help
  • AI Teacher
  • Solved questions
  • Free calculators
  • Learn by class

Exams & papers

  • JEE Main & Adv
  • NEET UG
  • CBSE 11–12
  • BITSAT
  • CUET UG
  • AP Physics & Calc
  • IB Diploma
  • GCSE & A-Levels
  • Papers

    JEE Main papersJEE Adv papersNEET papersCBSE papers

© 2026 Doubtclip Technologies Inc. All rights reserved.

PrivacyTermsPricingSearchBlog
Topics/Computer Science

Computer Science · College · BCA, BTech & MCA

SQL Masterclass: DDL/DML, Joins & Database Normalization (1NF–BCNF)

Master Structured Query Language (SQL) and relational design: DDL vs DML commands, Inner/Left/Right/Outer Joins, and Step-by-Step Normalization from 1NF to BCNF.

SQL Command Categories (DDL, DML, DQL, DCL, TCL)Relational Joins: Inner, Left, Right & Full OuterDatabase Normalization: 1NF, 2NF, 3NF & BCNF

1SQL Command Categories (DDL, DML, DQL, DCL, TCL)

SQL Masterclass: DDL/DML, Joins & Database Normalization (1NF–BCNF): Subject, Target Audience, Topic Core Full size

SQL Masterclass: DDL/DML, Joins & Database Normalization (1NF–BCNF)

Master Structured Query Language (SQL) and relational design: DDL vs DML commands, Inner/Left/Right/Outer Joins, and Step-by-Step Normalization from 1NF to BCNF.

  1. 1Subject — Computer Science
  2. 2Target Audience — BCA, BTech & MCA Students
  3. 3Topic Core — Queries, Join Types & 1NF, 2NF, 3NF, BCNF

SQL (Structured Query Language)is the standardized declarative language for managing relational databases. SQL statements are categorized into functional sub-languages according to their role in the database lifecycle.

SQL Sub-Languages Taxonomy

CategoryFull NamePrimary PurposeCore Commands
DDLData Definition LanguageDefines, modifies, or drops table schemas and database structuresCREATE \text{CREATE}\ CREATE , ALTER \text{ALTER}\ ALTER , DROP \text{DROP}\ DROP , TRUNCATE \text{TRUNCATE}\ TRUNCATE , RENAME \text{RENAME}\ RENAME 
DMLData Manipulation LanguageModifies data stored inside existing tablesINSERT \text{INSERT}\ INSERT , UPDATE \text{UPDATE}\ UPDATE , DELETE \text{DELETE}\ DELETE 
DQLData Query LanguageRetrieves data from one or more tables without mutationSELECT \text{SELECT}\ SELECT  (with WHERE \text{WHERE}\ WHERE , GROUP BY \text{GROUP BY}\ GROUP BY , HAVING \text{HAVING}\ HAVING , ORDER BY \text{ORDER BY}\ ORDER BY )
DCLData Control LanguageManages user privileges and security rolesGRANT \text{GRANT}\ GRANT , REVOKE \text{REVOKE}\ REVOKE 
TCLTransaction Control LanguageManages execution state of atomic transactionsCOMMIT \text{COMMIT}\ COMMIT , ROLLBACK \text{ROLLBACK}\ ROLLBACK , SAVEPOINT \text{SAVEPOINT}\ SAVEPOINT 
  • DDL

    Full Name
    Data Definition Language
    Primary Purpose
    Defines, modifies, or drops table schemas and database structures
    Core Commands
    CREATE \text{CREATE}\ CREATE , ALTER \text{ALTER}\ ALTER , DROP \text{DROP}\ DROP , TRUNCATE \text{TRUNCATE}\ TRUNCATE , RENAME \text{RENAME}\ RENAME 
  • DML

    Full Name
    Data Manipulation Language
    Primary Purpose
    Modifies data stored inside existing tables
    Core Commands
    INSERT \text{INSERT}\ INSERT , UPDATE \text{UPDATE}\ UPDATE , DELETE \text{DELETE}\ DELETE 
  • DQL

    Full Name
    Data Query Language
    Primary Purpose
    Retrieves data from one or more tables without mutation
    Core Commands
    SELECT \text{SELECT}\ SELECT  (with WHERE \text{WHERE}\ WHERE , GROUP BY \text{GROUP BY}\ GROUP BY , HAVING \text{HAVING}\ HAVING , ORDER BY \text{ORDER BY}\ ORDER BY )
  • DCL

    Full Name
    Data Control Language
    Primary Purpose
    Manages user privileges and security roles
    Core Commands
    GRANT \text{GRANT}\ GRANT , REVOKE \text{REVOKE}\ REVOKE 
  • TCL

    Full Name
    Transaction Control Language
    Primary Purpose
    Manages execution state of atomic transactions
    Core Commands
    COMMIT \text{COMMIT}\ COMMIT , ROLLBACK \text{ROLLBACK}\ ROLLBACK , SAVEPOINT \text{SAVEPOINT}\ SAVEPOINT 
sql· SQL DDL & DML Schema Creation and Aggregation Query
-- DDL: Create Tables with Foreign Key Constraint
CREATE TABLE Departments (
    dept_id INT PRIMARY KEY,
    dept_name VARCHAR(50) NOT NULL
);

CREATE TABLE Employees (
    emp_id INT PRIMARY KEY,
    name VARCHAR(50) NOT NULL,
    salary DECIMAL(10, 2) CHECK (salary > 0),
    dept_id INT,
    FOREIGN KEY (dept_id) REFERENCES Departments(dept_id)
);

-- DQL: Aggregate query with HAVING filter
SELECT d.dept_name, COUNT(e.emp_id) AS total_staff, AVG(e.salary) AS avg_sal
FROM Departments d
JOIN Employees e ON d.dept_id = e.dept_id
GROUP BY d.dept_name
HAVING AVG(e.salary) > 60000
ORDER BY avg_sal DESC;
Output:
+-------------+-------------+----------+
| dept_name   | total_staff | avg_sal  |
+-------------+-------------+----------+
| Engineering | 14          | 92500.00 |
| Product     | 6           | 78000.00 |
+-------------+-------------+----------+

2Relational Joins: Inner, Left, Right & Full Outer

AJOINclause combines rows from two or more tables based on a related common column between them. Relational algebra sets determine whether unmatched rows are retained or excluded.

SQL Join Types Matrix

Join TypeRelational Output BehaviorUnmatched Left Rows?Unmatched Right Rows?
INNER JOINReturns rows only when there is a match in both tablesExcludedExcluded
LEFT OUTER JOINReturns all rows from left table, plus matched rows from right (fills NULL for missing right)RetainedExcluded (unless matched)
RIGHT OUTER JOINReturns all rows from right table, plus matched rows from left (fills NULL for missing left)Excluded (unless matched)Retained
FULL OUTER JOINReturns all rows when there is a match in either table (combines LEFT and RIGHT joins)Retained (with NULLs)Retained (with NULLs)
CROSS JOINCartesian product: combines every row of Table A with every row of Table B (Size: m × n)N/AN/A
  • INNER JOIN

    Relational Output Behavior
    Returns rows only when there is a match in both tables
    Unmatched Left Rows?
    Excluded
    Unmatched Right Rows?
    Excluded
  • LEFT OUTER JOIN

    Relational Output Behavior
    Returns all rows from left table, plus matched rows from right (fills NULL for missing right)
    Unmatched Left Rows?
    Retained
    Unmatched Right Rows?
    Excluded (unless matched)
  • RIGHT OUTER JOIN

    Relational Output Behavior
    Returns all rows from right table, plus matched rows from left (fills NULL for missing left)
    Unmatched Left Rows?
    Excluded (unless matched)
    Unmatched Right Rows?
    Retained
  • FULL OUTER JOIN

    Relational Output Behavior
    Returns all rows when there is a match in either table (combines LEFT and RIGHT joins)
    Unmatched Left Rows?
    Retained (with NULLs)
    Unmatched Right Rows?
    Retained (with NULLs)
  • CROSS JOIN

    Relational Output Behavior
    Cartesian product: combines every row of Table A with every row of Table B (Size: m × n)
    Unmatched Left Rows?
    N/A
    Unmatched Right Rows?
    N/A

3Database Normalization: 1NF, 2NF, 3NF & BCNF

Definition

Database Normalization — The formal mathematical process of decomposing tables with redundancies into well-structured tables to eliminate update, insertion, and deletion anomalies.

Normal Form Progression Steps

  1. 1

    Unnormalized (UNF)

    Tables contain repeating groups or multi-valued attributes (e.g. Phone = "9876, 5432")

  2. 2

    1st Normal Form (1NF)

    All attributes contain strictly atomic (indivisible) scalar values; each record is unique

  3. 3

    2nd Normal Form (2NF)

    Must be in 1NF AND eliminate partial functional dependencies (all non-key attributes fully dependent on whole primary key)

  4. 4

    3rd Normal Form (3NF)

    Must be in 2NF AND eliminate transitive functional dependencies (no non-key attribute depends on another non-key attribute: X → Y → Z)

  5. 5

    Boyce-Codd (BCNF)

    Strict 3NF: For every functional dependency X → Y, the determinant X must strictly be a Super Key

Exam tip: In enterprise systems, databases are typically normalized up to3NF / BCNFfor OLTP (Online Transaction Processing) to guarantee transactional integrity, and intentionallydenormalized(star/snowflake schemas) for OLAP data warehouses to accelerate analytical reads.

Remember

  • SQL commands are segregated into DDL (structure), DML (records), DQL (retrieval), DCL (permissions), and TCL (transactions).
  • INNER JOIN extracts intersections; LEFT/RIGHT/FULL OUTER JOINs preserve records with missing relationships using NULL values.
  • 1NF demands atomic values; 2NF removes partial key dependencies; 3NF removes transitive dependencies (non-key determining non-key).
  • BCNF is a stricter form of 3NF where every functional dependency determinant must be a super key.

Check yourself

  1. Question 1

    A relation R(A, B, C, D) has primary key (A, B). If the functional dependency B → C exists, what normal form does this relation violate?
  2. Question 2

    What is the fundamental difference between DELETE \text{DELETE}\ DELETE  and TRUNCATE \text{TRUNCATE}\ TRUNCATE  commands in SQL?
Share with friends:WWhatsAppTelegram

Read it? Now test it. Timed exam questions on this topic, then a report on what to revise.

Take a test

Want a lesson on another topic? Type any topic or add a photo of your notes — get a lesson like this in seconds.

Learn a topic

More Computer Science explained

  • Operating Systems: Process Scheduling, Context Switching & DeadlocksCollege · BCA, BTech & MCA
  • Computer Networks: OSI 7-Layer Model & TCP/IP Protocol SuiteCollege · BCA, BTech & MCA
  • Java Architecture: JVM, JRE, JDK, Memory Areas & Garbage CollectionCollege · BCA, BTech & MCA
  • The 4 Pillars of OOP: Encapsulation, Abstraction, Inheritance & PolymorphismCollege · BCA, BTech & MCA
  • DBMS Architecture, Three-Schema Model & ACID PropertiesCollege · BCA, BTech & MCA
  • Binary Trees & BST: Tree Traversals, Search, Insert & BST RulesCollege · BCA, BTech & MCA
  • Searching & Sorting Algorithms: Binary Search, QuickSort & MergeSortCollege · BCA, BTech & MCA
  • Stacks, Queues & Recursion: LIFO, FIFO & Expression ParsingCollege · BCA, BTech & MCA