Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Summary SQL Notes

Rating
-
Sold
-
Pages
37
Uploaded on
28-09-2024
Written in
2024/2025

Summary of 37 pages for the course Computer Science at Hemwati Nandan Bahuguna Garhwal University (SQL summary notes)

Institution
Course

Content preview

Types of SQL Commands
There are five types of SQL commands: DDL, DML, DCL, TCL, and DQL.




1. Data Definition Language (DDL)
o DDL changes the structure of the table like creating a table, deleting a table,
altering a table, etc.
o All the command of DDL are auto-committed that means it permanently save
all the changes in the database.

Here are some commands that come under DDL:

• CREATE
• ALTER
• DROP
• TRUNCATE

,2. Data Manipulation Language
DML commands are used to modify the database. It is responsible for all form of
changes in the database.

The command of DML is not auto-committed that means it can't permanently save
all the changes in the database. They can be rollback.

Here are some commands that come under DML:

• INSERT
• UPDATE
• DELETE

3. Data Control Language
DCL commands are used to grant and take back authority from any database user.

Here are some commands that come under DCL:

• Grant
• Revoke

4. Transaction Control Language
TCL commands can only use with DML commands like INSERT, DELETE and UPDATE
only.

These operations are automatically committed in the database that's why they
cannot be used while creating tables or dropping them.

Here are some commands that come under TCL:

• COMMIT
• ROLLBACK
• SAVEPOINT

,5. Data Query Language
DQL is used to fetch the data from the database.

It uses only one command:

• SELECT



CREATE DATABASE command
The CREATE DATABASE statement is used to create a new SQL database.

Syntax:
• CREATE DATABASE databasename;
Example:
• CREATE DATABASE testDB;


USE DATABASE command
The SQL USE statement is used to select any existing database in the SQL schema.
Syntax:
• USE DatabaseName;


SHOW DATABASES
The SHOW statement is used to show the databases available on MYSQL server.

Syntax:
• SHOW DATABASES;

, Note: The SHOW SCHEMAS command is also used to show the databases available
on MySQL server.
Syntax:

• SHOW SCHEMAS;


CREATE TABLE command
The CREATE TABLE statement is used to create a new table in a database.

Syntax:
• CREATE TABLE table_name (
column1 datatype,
column2 datatype,
column3 datatype,
....
);
Example:

• CREATE TABLE Persons (
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);



DESCRIBE command
The DESCRIBE command is used to show the structure of our table.

Syntax: DESCRIBE/DESC table_name;

Written for

Institution
Course

Document information

Uploaded on
September 28, 2024
Number of pages
37
Written in
2024/2025
Type
SUMMARY

Subjects

$5.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
akhilsharma

Get to know the seller

Seller avatar
akhilsharma Hemwati Nandan Bahuguna Garhwal University
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
3
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions