Structured Query Language, Study notes of Database Management Systems (DBMS)

This is all about the basic of Structured Query Language. All the basic and Syntax is provided and also Example MCQ is also given.

Typology: Study notes

2021/2022

Available from 10/13/2022

guna-soundiri
guna-soundiri 🇮🇳

2 documents

1 / 81

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
SQL TYPES
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51

Partial preview of the text

Download Structured Query Language and more Study notes Database Management Systems (DBMS) in PDF only on Docsity!

SQL TYPES

SQL Types

  • (^) What is SQL?
  • (^) MySQL Database
  • (^) SQL Types
    • (^) Data Definition Language (DDL)

Data Manipulation Language (DML)

  • (^) Data Control Language (DCL)
  • (^) Transaction Control Language (TCL)

MySQL Database

To Create Database:

Syntax:

CREATE DATABASE database_name;

Example:

CREATE DATABASE srishakthi;

To Select Database:

Select Database is used in MySQL to select a particular database to work with. This

query is used when multiple databases are available with MySQL Server.

Syntax:

USE database_name;

Example:

USE srishakthi;

MySQL Database

To Show/List Databases:

Syntax:

SHOW DATABASES;

SHOW DATABASES LIKE pattern;

Example:

SHOW DATABASES LIKE “%thi”;

To Remove/Drop Database:

MySQL database can be easily removed with the MySQL DROP DATABASE command. It

deletes all the tables of the database along with the data permanently.

Syntax:

DROP DATABASE database_name;

Example:

DROP DATABASE srishakthi;

MySQL Database

MySQL Database

Data Definition Language (DDL)

CREATE

It is used to create a table.

Syntax:

CREATE TABLE TableName(Column1 datatype, Column2 datatype, ColumnN datatype);

Example:

Data Definition Language (DDL)

ALTER

This command is used to delete, modify or add constraints or columns in an

existing table.

To Add a Column:

ALTER TABLE TableName ADD ColumnName Datatype;

Data Definition Language (DDL)

To remove a column:

ALTER TABLE TableName DROP COLUMN ColumnName; (OR)

ALTER TABLE TableName DROP ColumnName;

Data Definition Language (DDL)

To modify a column:

ALTER TABLE TableName MODIFY ColumnName NewDatatype;

Data Definition Language (DDL)

TRUNCATE

This command is used to delete the information present in the table but does not

delete the table.

Syntax:

TRUNCATE TABLE TableName;

Example:

Data Definition Language (DDL)

DROP

This statement is used to drop an existing table. When you use this statement,

complete information present in the table will be lost.

Syntax:

DROP TABLE TableName;

Example:

Data Manipulation Language (DML)

INSERT

It is used to insert new records into the table.

Syntax:

INSERT INTO TableName VALUES (Value1, Value2, Value3, ...);

Example:

Data Manipulation Language (DML)

INSERT

It is used to insert new records into the table.

Syntax: (Specific Column Insertion)

INSERT INTO TableName (Column1, Column2, Column3, ...,ColumnN)

VALUES (value1, value2, value3, ...);

Example: