Simple Machines – Class 5 Free MCQ Test
Seeds and Germination – Class 5 Free MCQ Test-1
Seeds and Germination – Class 5 Free MCQ Test
Food and Health – Class 5 Free MCQ Test -3
Food and Health – Class 5 Free MCQ Test -2
Food and Health – Class 5 Free MCQ Test
Important SQL Commands
Important SQL Commands
1. CREATE DATABASE
Purpose
Used to create a new database.
Syntax
Example
Exam Question Example
Write a SQL command to create a database named LIBRARY.
2. CREATE TABLE
Purpose
Used to create a new table inside a database.
Syntax
column_name datatype,
column_name datatype
);
Example
rollno INT,
name VARCHAR(20),
class VARCHAR(5),
marks INT
);
3. DESC (DESCRIBE)
Purpose
Displays the structure of a table.
Syntax
Example
Output shows
-
column names
-
data types
-
null information
4. INSERT INTO
Purpose
Used to add records into a table.
Syntax
VALUES(value1,value2,value3);
Example
VALUES(101,‘Rahul’,‘XI’,85);
Insert using column names
VALUES(102,‘Riya’,90);
5. SELECT
Purpose
Used to retrieve data from a table.
Syntax
FROM table_name;
Example
6. SELECT *
Purpose
Display all columns from the table.
Syntax
Example
7. DISTINCT
Purpose
Used to remove duplicate values.
Syntax
FROM table_name;
Example
FROM employee;
8. WHERE
Purpose
Used to apply conditions while retrieving data.
Syntax
WHERE condition;
Example
WHERE marks > 80;
9. UPDATE
Purpose
Used to modify existing records.
Syntax
SET column=value
WHERE condition;
Example
SET marks = 88
WHERE rollno = 101;
10. DELETE
Purpose
Used to remove records from a table.
Syntax
WHERE condition;
Example
WHERE rollno = 103;
NOTE : If WHERE clause is omitted, all records will be deleted.
11. ALTER TABLE
Purpose
Used to modify the structure of a table.
Add Column
ADD address VARCHAR(30);
Modify Column
MODIFY name VARCHAR(25);
Drop Column
DROP address;
12. DROP TABLE
Purpose
Used to delete a table permanently.
Syntax
Example
13. ORDER BY
Purpose
Used to sort records.
Syntax
ORDER BY column_name;
Ascending Order
ORDER BY marks ASC;
Descending Order
ORDER BY marks DESC;
14. LIKE
Purpose
Used for pattern matching.
Symbols Used
| Symbol | Meaning |
|---|---|
| % | Any number of characters |
| _ | Single character |
Example
Names starting with R
WHERE name LIKE ‘R%’;
Names ending with a
WHERE name LIKE ‘%a’;
15. BETWEEN
Purpose
Used to select values within a range.
Syntax
WHERE column BETWEEN value1 AND value2;
Example
WHERE marks BETWEEN 70 AND 90;
16. IN
Purpose
Used to match values from a list.
Syntax
WHERE column IN (value1,value2);
Example
WHERE class IN (‘XI’,‘XII’);
17. Logical Operators
Used to combine conditions.
| Operator | Purpose |
|---|---|
| AND | Both conditions must be true |
| OR | At least one condition true |
| NOT | Reverse condition |
Example
WHERE marks > 80 AND class=‘XI’;
Data Manipulation (DML)
Used to add, change, or remove the actual records (rows).
-
INSERT:
INSERT INTO student VALUES (101, 'Rahul', 'XI', 85); -
UPDATE:
UPDATE student SET marks = 88 WHERE rollno = 101;-
⚠️ Note: Always use
WHEREor all rows will be updated!
-
-
DELETE:
DELETE FROM student WHERE rollno = 103;-
⚠️ Note:
DELETE FROM student;removes all data but keeps the table structure.
-
Data Retrieval & Filtering (DQL)
The most common commands for fetching specific information.
The Basic Select
-
SELECT * FROM student;(Show all columns) -
SELECT name, marks FROM student;(Show specific columns) -
SELECT DISTINCT city FROM employee;(Removes duplicate entries)
Filtering with WHERE
-
Relational:
WHERE marks > 80; -
List Match:
WHERE class IN ('XI', 'XII'); -
Range:
WHERE marks BETWEEN 70 AND 90; -
Pattern Matching (LIKE):
-
LIKE 'R%'→ Starts with ‘R’ -
LIKE '%a'→ Ends with ‘a’ -
LIKE '_i%'→ ‘i’ is the second character
-
Sorting & Logic
-
ORDER BY:
ORDER BY marks DESC;(UseASCfor smallest to largest) -
AND / OR: Combine conditions (e.g.,
WHERE marks > 80 AND class = 'XI')
Exam Tips for Students
-
Semicolons: Don’t forget to end every command with
;. -
Quotes: Use single quotes
' 'forVARCHAR,CHAR, andDATEvalues. Numbers do not need quotes. -
DROP vs DELETE:
DROPkills the table;DELETEkills the rows inside the table. -
NULL: Use
IS NULLorIS NOT NULLto check for empty values (never use= NULL).
Class 11 IP Introduction to My SQL notes
Class 11 Informatics Practices – Introduction to SQL Notes
NCERT Class 11 Informatics Practices Chapter 8 – Introduction to SQL.
1. What is a Database?
A database is an organized collection of related data stored in a structured way so that it can be easily accessed and managed.
Example
| Roll No | Name | Class | Marks |
|---|---|---|---|
| 101 | Rahul | XI | 85 |
| 102 | Priya | XI | 92 |
2. DBMS (Database Management System)
A DBMS is software that allows users to create, manage and manipulate databases.
Functions of DBMS
- Data storage
- Data retrieval
- Data modification
- Data security
- Data sharing
Examples of DBMS
- MySQL
- Oracle
- Microsoft SQL Server
- PostgreSQL
3. RDBMS (Relational Database Management System)
An RDBMS stores data in the form of tables consisting of rows and columns.
- Row → Record
- Column → Field
Example Table
| RollNo | Name | Class |
|---|---|---|
| 101 | Rahul | XI |
| 102 | Riya | XI |
4. What is SQL?
SQL (Structured Query Language) is used to communicate with a database.
Using SQL we can:
- Create databases
- Create tables
- Insert records
- Retrieve records
- Update records
- Delete records
Example Query
SELECT * FROM student;
This query displays all records from the student table.
5. Characteristics of SQL
- SQL is case insensitive
( SELECT
select
Select )
All mean the same. - SQL Commands end with a semicolon
SELECT * FROM student; - SQL Queries can be written in multiple lines
6. SQL Command Categories
1. DDL (Data Definition Language)
DDL commands define database structure.
| Command | Purpose |
|---|---|
| CREATE | Create database or table |
| ALTER | Modify table structure |
| DROP | Delete table or database |
| DESC | Display table structure |
Example
CREATE DATABASE SchoolDB;
7. CREATE TABLE
CREATE TABLE student( rollno INT, name CHAR(20), class CHAR(5), marks INT );
8. INSERT Command
Used to insert records into a table.
INSERT INTO student VALUES(101,'Rahul','XI',85);
9. SELECT Command
Used to retrieve data from tables.
SELECT * FROM student;
To display only specific columns:
SELECT name FROM student;
10. UPDATE Command
Used to modify existing records.
UPDATE student SET marks = 88 WHERE rollno = 101;
11. DELETE Command
Used to remove records from a table.
DELETE FROM student WHERE rollno = 103;
12. SQL Clauses
WHERE Clause
SELECT * FROM student WHERE marks > 80;
ORDER BY Clause
SELECT * FROM student ORDER BY marks DESC;
DISTINCT Clause
SELECT DISTINCT name FROM student;
LIKE Clause
SELECT * FROM student WHERE name LIKE 'R%';
13. Logical Operators
- AND
- OR
- NOT
Example
SELECT * FROM student WHERE marks > 80 AND class = 'XI';
14. Important Database Terms
| Term | Meaning |
|---|---|
| Table | Collection of rows and columns |
| Field | Column in a table |
| Record | Row containing complete information |
| Primary Key | Unique identifier of a record |
Important SQL Commands for Exams
CREATE DATABASE
CREATE TABLE
DESC
INSERT INTO
SELECT
UPDATE
DELETE
ALTER
DROP