









































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
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
1 / 81
This page cannot be seen from the preview
Don't miss anything!










































































Data Manipulation Language (DML)
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;
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;
It is used to create a table.
Syntax:
CREATE TABLE TableName(Column1 datatype, Column2 datatype, ColumnN datatype);
Example:
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;
To remove a column:
ALTER TABLE TableName DROP COLUMN ColumnName; (OR)
ALTER TABLE TableName DROP ColumnName;
To modify a column:
ALTER TABLE TableName MODIFY ColumnName NewDatatype;
This command is used to delete the information present in the table but does not
delete the table.
Syntax:
TRUNCATE TABLE TableName;
Example:
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:
It is used to insert new records into the table.
Syntax:
INSERT INTO TableName VALUES (Value1, Value2, Value3, ...);
Example:
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: