0% found this document useful (0 votes)
5 views2 pages

SQL Commands With Examples

The document outlines the different types of SQL commands, categorized into DDL, DML, DCL, TCL, and DQL, along with examples for each type. DDL includes commands for defining database structures, DML is for manipulating data, DCL handles permissions, TCL manages transactions, and DQL is used for querying data. Each section provides specific SQL command examples to illustrate their usage.

Uploaded by

pkbharath922
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

SQL Commands With Examples

The document outlines the different types of SQL commands, categorized into DDL, DML, DCL, TCL, and DQL, along with examples for each type. DDL includes commands for defining database structures, DML is for manipulating data, DCL handles permissions, TCL manages transactions, and DQL is used for querying data. Each section provides specific SQL command examples to illustrate their usage.

Uploaded by

pkbharath922
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Types of SQL Commands

Types of SQL Commands with Examples

1. DDL (Data Definition Language)

Examples:

CREATE TABLE Students (

ID INT PRIMARY KEY,

Name VARCHAR(50),

Age INT

);

ALTER TABLE Students ADD Email VARCHAR(100);

DROP TABLE Students;

TRUNCATE TABLE Students;

RENAME TABLE Students TO Learners;

2. DML (Data Manipulation Language)

Examples:

SELECT * FROM Students;

INSERT INTO Students (ID, Name, Age) VALUES (1, 'John Doe', 20);

UPDATE Students SET Age = 21 WHERE ID = 1;

DELETE FROM Students WHERE ID = 1;

3. DCL (Data Control Language)

Examples:
Types of SQL Commands

GRANT SELECT, INSERT ON Students TO user_name;

REVOKE INSERT ON Students FROM user_name;

4. TCL (Transaction Control Language)

Examples:

BEGIN;

UPDATE Students SET Age = 22 WHERE ID = 2;

SAVEPOINT UpdatePoint;

DELETE FROM Students WHERE ID = 2;

ROLLBACK TO UpdatePoint;

COMMIT;

5. DQL (Data Query Language)

Example:

SELECT Name, Age FROM Students WHERE Age > 18;

You might also like