NCERTCh 9Free

Structured Query Language (SQL)

🎓 Class 12📖 Computer Science📖 9 notes🧠 13 Q&A⏱️ ~14 min

Structured Query Language (SQL)Study Notes

NCERT-aligned · 9 notes · 3 shown free

Introduction to SQL

Explanation

Introduction to SQL

Structured Query Language (SQL) is a standardized programming language specifically designed for managing and manipulating relational databases. It provides a systematic and efficient way to communicate with database management systems (DBMS) to perform various operations such as creating, retrieving, updating, and deleting data. SQL enables users to interact with the data stored in tables, which are organized in rows and columns, following the relational model. The language is declarative, meaning users specify what data they want without detailing how to retrieve it. SQL is widely used in various applications ranging from small-scale personal databases to large enterprise systems. The language is divided into several sublanguages, each serving a distinct purpose: Data Definition Language (DDL), Data Manipulation Language (DML), Data Control Language (DCL), and Transaction Control Language (TCL). This chapter introduces these components and explains how SQL commands are structured and executed to manage database objects and data effectively.

  • SQL is a standard language for managing and manipulating relational databases.
  • It is declarative, focusing on what data to retrieve rather than how to retrieve it.
  • SQL operates on tables organized in rows and columns.
  • The language is divided into DDL, DML, DCL, and TCL sublanguages.
  • SQL commands enable creation, retrieval, modification, and control of data and database structures.
  • It is widely used across various domains for database management.
  • 📌 SQL: Structured Query Language, a language for managing relational databases.
  • 📌 Relational Database: A database structured to recognize relations among stored items of information.
  • 📌 Declarative Language: A programming language that expresses the logic of computation without describing its control flow.

Data Definition Language (DDL)

Explanation

Data Definition Language (DDL)

Data Definition Language (DDL) is a subset of SQL commands that define and modify the structure of database objects such as tables, indexes, and schemas. These commands are essential for creating the database schema and organizing data storage. The primary DDL commands include CREATE, ALTER, and DROP. The CREATE command is used to create new tables or other database objects, specifying the columns, data types, and constraints. ALTER modifies the structure of existing tables, such as adding or deleting columns or changing data types. DROP deletes tables or other objects permanently from the database. DDL commands affect the metadata of the database and are auto-committed, meaning changes are immediately saved. Understanding DDL is crucial for designing the database layout before manipulating the data within it.

  • DDL commands define and modify database structures.
  • CREATE command is used to create new tables and database objects.
  • ALTER command modifies existing table structures.
  • DROP command deletes tables or database objects permanently.
  • DDL commands affect the schema and metadata of the database.
  • Changes made by DDL commands are auto-committed.
  • 📌 CREATE: SQL command to create database objects.
  • 📌 ALTER: SQL command to modify existing database objects.
  • 📌 DROP: SQL command to delete database objects.

Data Manipulation Language (DML)

Explanation

Data Manipulation Language (DML)

Data Manipulation Language (DML) comprises SQL commands that allow users to retrieve, insert, update, and delete data within database tables. Unlike DDL, which deals with the structure of the database, DML focuses on the content or data stored in the

Practice QuestionsStructured Query Language (SQL)

Includes NCERT exercise questions with answers

Q1.Which is an incorrect statement?
A.Push and Pop operations in Stack take place at top
B.Insertion of an element in queue takes place at rear end
C.Deletion of an element in queue takes place at front end
D.Reversing of a string is an application of Queue data structure

Answer:

Reversing of a string is an application of Queue data structure

MediumNCERT
Q2.Adding an element to queue and removing an element from queue are known as
A.Push and Pop
B.Enqueue and Dequeue
C.Insert and Delete
D.None

Answer:

Enqueue and Dequeue

MediumNCERT
Q3.A queue in which elements get inserted in empty area in front of a queue is called
A.Full Queue
B.Circular Queue
C.Rounded Queue
D.Rotated Queue

Answer:

Circular Queue

MediumNCERT
Q4.If we want to delete an element from an empty data structure, it is called
A.Underflow
B.Overflow
C.Extraflow
D.None

Answer:

Underflow

MediumNCERT
Q5.If we want to insert an element in already full stack and there is no new element that can be accommodated, it is called an
A.Underflow
B.Overflow
C.Extraflow
D.None

Answer:

Overflow

MediumNCERT
Q6.PUSH and POP operations are related to which data structure?
A.Queue
B.Stack
C.Tree
D.None

Answer:

Stack

MediumNCERT
Q7.In which data structure element is inserted at rear and deleted at front?
A.Queue
B.Stack
C.Tree
D.None

Answer:

Queue

MediumNCERT
Q8.Which of the following is an application of Stack data structure?
A.Reversing of a string
B.Infix to Prefix
C.Finding factorial by recursion
D.All of the above

Answer:

All of the above

MediumNCERT