Tuesday, May 12, 2026

SQL Basics (1–20)

  1. What is SQL?
    SQL (Structured Query Language) is used to store, retrieve, manage, and manipulate data in databases.
  2. What are the main types of SQL commands?
    DDL, DML, DQL, DCL, and TCL.
  3. What is DDL?
    Data Definition Language is used to define database objects like tables (CREATE, ALTER, DROP).
  4. What is DML?
    Data Manipulation Language is used to modify data (INSERT, UPDATE, DELETE).
  5. What is DQL?
    Data Query Language is used to fetch data (SELECT).
  6. What is DCL?
    Data Control Language is used for permissions (GRANT, REVOKE).
  7. What is TCL?
    Transaction Control Language is used to manage transactions (COMMIT, ROLLBACK).
  8. What is a database?
    A database is an organized collection of structured data.
  9. What is a table?
    A table is a collection of rows and columns used to store data.
  10. What is a row in SQL?
    A row represents a single record in a table.
  11. What is a column in SQL?
    A column represents a specific attribute of data in a table.
  12. What is a schema?
    A schema is a logical container for database objects like tables and views.
  13. What is a primary key?
    A primary key uniquely identifies each record in a table.
  14. What is a foreign key?
    A foreign key links one table to another using a referenced key.
  15. What is a unique key?
    It ensures all values in a column are unique.
  16. What is the difference between primary key and unique key?
    Primary key does not allow NULL; unique key allows one NULL (DB dependent).
  17. What is NOT NULL?
    It ensures a column cannot store NULL values.
  18. What is DEFAULT constraint?
    It assigns a default value when no value is provided.
  19. What is CHECK constraint?
    It restricts values allowed in a column.
  20. What is the difference between DELETE, TRUNCATE, and DROP?
    DELETE removes rows, TRUNCATE removes all rows, DROP removes the table.

https://www.youtube.com/playlist?list=PLQM-BpTd9ZSumxwKgJjuJjlx2OcP_W516