SlideShare a Scribd company logo
By : Abhishek Gautam
 SQL stands for Structured Query Language.
 SQL is a database management language for relational databases.
 SQL lets you access and manipulate databases.
 SQL queries are not case sensitive. (SELECT = select)
 Data Manipulation Language (DML) is used to add, update or
delete data . Examples: INSERT, DELETE and UPDATE.
 Data Definition Language (DDL) is used for managing tables and
index structures. Examples: CREATE, ALTER,TRUNCATE and
DROP.
 Data Control Language (DCL) is used to assign and revoke
database rights and permissions. Its main statements are GRANT
and REVOKE.
 SELECT - extracts data from a database
 UPDATE - updates data in a database
 DELETE - deletes data from a database
 INSERT INTO - inserts new data into a database
 CREATETABLE - creates a new table
 ALTERTABLE - modifies a table
 DROPTABLE - deletes a table
 The CREATETABLE statement is used to create a table in a
database.
 CREATETABLE table_name(
column_name1 data_type(size),
column_name2 data_type(size),
column_name3 data_type(size),
....
);
 E.g. : CREATETABLE People(
ID int,
FirstName varchar(255),
LastName varchar(255),
);
 The INSERT INTO statement is used to insert new records in a
table.
 INSERT INTO table_name
(column1, column2,..)
VALUES ( Value1,Value2,…)
 E.g. : INSERT INTO Customers(ID, FirstName, LastName)
VALUES (1,’Abhi’,’Gautam’)
 The UPDATE statement is used to update existing records in a
table.
 UPDATE table_name
SET column1=value1,column2=value2,...
WHERE some_column=some_value;
 E.g. : UPDATE Customers
SET FirstName =‘Abhishek'
WHERE ID=1;
 The DELETE statement is used to delete records in a table.
 DELETE FROM table_name
WHERE some_column=some_value;
 E.g. : DELETE FROM Customers
WHERE FirstName =‘Abhishek'
 The ALTERTABLE statement is used to add, delete, or modify columns
in an existing table.
 ALTERTABLE table_name
ADD column_name datatype
 ALTERTABLE table_name
DROP COLUMN column_name
 ALTERTABLE table_name
ALTER COLUMN column_name datatype
 The DROPTABLE statement is used to delete an existing table.
 DROPTABLETable_Name;
 E.g. : DROPTABLE Customers;
 SELECT * FROM table_name;
 SELECT column_name,column_name
FROM table_name;
 E.g. : SELECT * FROM Customers;
SELECT FirstName FROM Customers;
 The SELECT DISTINCT statement is used to return only distinct
(different) values.
 SELECT DISTINCT column_name,column_name
FROM table_name;
 E.g. : SELECT DISTINCT FirstName FROM Customers;
 The WHERE clause is used to filter records.
 SELECT column_name,column_name
FROM table_name
WHERE column_name operator value;
 E.g. : SELECT DISTINCT FirstName FROM People
WHERE ID=5;
 The AND operator displays a record if both the first condition AND the
second condition are true.
 The OR operator displays a record if either the first condition OR the
second condition is true.
 E.g. : SELECT * FROM Customers
WHERE FirstName=‘Abhishek'
AND LastName=‘Gautam';
 SELECT * FROM Customers
WHERE FirstName=‘Abhishek'
OR LastName=‘Gautam';
 GROUP BY clause is used to group the result based on the Column
named in the GROUP BY clause.
 SELECT Col_list FROM Table_Name
WHERE where_condition
GROUP BY col_list ;
 ORDER BY clause is used to organize the result in ascending or
descending order based on the Column named in the ORDER BY
clause. Ascending order segregation is by default, to organize the
result in descending order we have to use DESC clause.
 SELECT Col_list FROMTable_Name WHERE where_condition
GROUP BY col_list
ORDER BY col_name DESC ;
 JOIN clause is used to get result from two or more table which have
a common column.
 SELECT a.col_name,b.col_name FROM
Table1_Name a
JOIN Table2_Name b
ON a.col_Name=b.col_Name;
 INNER JOIN: Returns all rows when there is at least one match in BOTH
tables
 LEFT JOIN: Return all rows from the left table, and the matched rows
from the right table
 RIGHT JOIN: Return all rows from the right table, and the matched rows
from the left table
 FULL JOIN: Return all rows when there is a match inONE of the tables
 User Defined functions
 Built-in functions
 COUNT()
 MAX()
 REPLACE()
 SUBSTRING()

More Related Content

What's hot

STRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIESSTRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIES
VENNILAV6
 
Oracle: Joins
Oracle: JoinsOracle: Joins
Oracle: Joins
DataminingTools Inc
 
Sql joins
Sql joinsSql joins
Sql joins
Gaurav Dhanwant
 
SQL JOINS
SQL JOINSSQL JOINS
SQL JOINS
Swapnali Pawar
 
Join query
Join queryJoin query
Join query
Waqar Ali
 
Join sql
Join sqlJoin sql
Join sql
Vikas Gupta
 
Sql join
Sql  joinSql  join
Sql join
Vikas Gupta
 
MySQL notes - Basic Commands and Definitions
MySQL notes - Basic Commands and DefinitionsMySQL notes - Basic Commands and Definitions
MySQL notes - Basic Commands and Definitions
DeepakDeedarSingla
 
SQL Joins
SQL JoinsSQL Joins
SQL Joins
Paul Harkins
 
Sql – Structured Query Language
Sql – Structured Query LanguageSql – Structured Query Language
Sql – Structured Query Languagepandey3045_bit
 
introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
farwa waqar
 
Sql commands
Sql commandsSql commands
Sql commands
Mohd Tousif
 
Sql joins inner join self join outer joins
Sql joins inner join self join outer joinsSql joins inner join self join outer joins
Sql joins inner join self join outer joins
Deepthi Rachumallu
 

What's hot (16)

Sql commands
Sql commandsSql commands
Sql commands
 
STRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIESSTRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIES
 
Oracle: Joins
Oracle: JoinsOracle: Joins
Oracle: Joins
 
MySQL JOIN & UNION
MySQL JOIN & UNIONMySQL JOIN & UNION
MySQL JOIN & UNION
 
Sql joins
Sql joinsSql joins
Sql joins
 
SQL JOINS
SQL JOINSSQL JOINS
SQL JOINS
 
Join query
Join queryJoin query
Join query
 
Join sql
Join sqlJoin sql
Join sql
 
Sql join
Sql  joinSql  join
Sql join
 
MySQL notes - Basic Commands and Definitions
MySQL notes - Basic Commands and DefinitionsMySQL notes - Basic Commands and Definitions
MySQL notes - Basic Commands and Definitions
 
Joins And Its Types
Joins And Its TypesJoins And Its Types
Joins And Its Types
 
SQL Joins
SQL JoinsSQL Joins
SQL Joins
 
Sql – Structured Query Language
Sql – Structured Query LanguageSql – Structured Query Language
Sql – Structured Query Language
 
introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
 
Sql commands
Sql commandsSql commands
Sql commands
 
Sql joins inner join self join outer joins
Sql joins inner join self join outer joinsSql joins inner join self join outer joins
Sql joins inner join self join outer joins
 

Similar to SQL : Structured Query Language

DBMS and SQL(structured query language) .pptx
DBMS and SQL(structured query language) .pptxDBMS and SQL(structured query language) .pptx
DBMS and SQL(structured query language) .pptx
jainendraKUMAR55
 
SQL
SQLSQL
Avinash database
Avinash databaseAvinash database
Avinash databaseavibmas
 
SQL Query
SQL QuerySQL Query
SQL Query
Imam340267
 
SQL Tutorial for Beginners
SQL Tutorial for BeginnersSQL Tutorial for Beginners
SQL Tutorial for Beginners
Abdelhay Shafi
 
Oraclesql
OraclesqlOraclesql
Oraclesql
Priya Goyal
 
Mysql 120831075600-phpapp01
Mysql 120831075600-phpapp01Mysql 120831075600-phpapp01
Mysql 120831075600-phpapp01sagaroceanic11
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
Shrija Madhu
 
Introduction to sql new
Introduction to sql newIntroduction to sql new
Introduction to sql newSANTOSH RATH
 
MySQL Essential Training
MySQL Essential TrainingMySQL Essential Training
MySQL Essential Training
HudaRaghibKadhim
 
SQL Class Note By Amit Maity PowerPoint Presentation
SQL Class Note By Amit Maity PowerPoint PresentationSQL Class Note By Amit Maity PowerPoint Presentation
SQL Class Note By Amit Maity PowerPoint Presentation
maitypradip938
 
Creating database using sql commands
Creating database using sql commandsCreating database using sql commands
Creating database using sql commandsBelle Wx
 
DBMS.pdf
DBMS.pdfDBMS.pdf
DBMS.pdf
Rishab Saini
 
Creating a database
Creating a databaseCreating a database
Creating a databaseRahul Gupta
 
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
SakkaravarthiS1
 
SQL Quick Reference Card
SQL Quick Reference CardSQL Quick Reference Card
SQL Quick Reference Card
Techcanvass
 
MY SQL
MY SQLMY SQL
MY SQL
sundar
 

Similar to SQL : Structured Query Language (20)

DBMS and SQL(structured query language) .pptx
DBMS and SQL(structured query language) .pptxDBMS and SQL(structured query language) .pptx
DBMS and SQL(structured query language) .pptx
 
Sql
SqlSql
Sql
 
SQL
SQLSQL
SQL
 
Avinash database
Avinash databaseAvinash database
Avinash database
 
SQL Query
SQL QuerySQL Query
SQL Query
 
SQL Tutorial for Beginners
SQL Tutorial for BeginnersSQL Tutorial for Beginners
SQL Tutorial for Beginners
 
Oraclesql
OraclesqlOraclesql
Oraclesql
 
Mysql 120831075600-phpapp01
Mysql 120831075600-phpapp01Mysql 120831075600-phpapp01
Mysql 120831075600-phpapp01
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
 
Introduction to sql new
Introduction to sql newIntroduction to sql new
Introduction to sql new
 
MySQL Essential Training
MySQL Essential TrainingMySQL Essential Training
MySQL Essential Training
 
SQL Class Note By Amit Maity PowerPoint Presentation
SQL Class Note By Amit Maity PowerPoint PresentationSQL Class Note By Amit Maity PowerPoint Presentation
SQL Class Note By Amit Maity PowerPoint Presentation
 
Creating database using sql commands
Creating database using sql commandsCreating database using sql commands
Creating database using sql commands
 
DBMS.pdf
DBMS.pdfDBMS.pdf
DBMS.pdf
 
Sql Tags
Sql TagsSql Tags
Sql Tags
 
Creating a database
Creating a databaseCreating a database
Creating a database
 
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
Unit-1 SQL fundamentals.docx SQL commands used to create table, insert values...
 
Les10
Les10Les10
Les10
 
SQL Quick Reference Card
SQL Quick Reference CardSQL Quick Reference Card
SQL Quick Reference Card
 
MY SQL
MY SQLMY SQL
MY SQL
 

More from Abhishek Gautam

Power Bi Basics
Power Bi BasicsPower Bi Basics
Power Bi Basics
Abhishek Gautam
 
Apache Pig
Apache PigApache Pig
Apache Pig
Abhishek Gautam
 
Apache Hive
Apache HiveApache Hive
Apache Hive
Abhishek Gautam
 
Big data
Big dataBig data
Big data
Abhishek Gautam
 
Rsa cryptosystem
Rsa cryptosystemRsa cryptosystem
Rsa cryptosystem
Abhishek Gautam
 
Enterprise application environment
Enterprise application environmentEnterprise application environment
Enterprise application environment
Abhishek Gautam
 
Software testing
Software testingSoftware testing
Software testing
Abhishek Gautam
 

More from Abhishek Gautam (7)

Power Bi Basics
Power Bi BasicsPower Bi Basics
Power Bi Basics
 
Apache Pig
Apache PigApache Pig
Apache Pig
 
Apache Hive
Apache HiveApache Hive
Apache Hive
 
Big data
Big dataBig data
Big data
 
Rsa cryptosystem
Rsa cryptosystemRsa cryptosystem
Rsa cryptosystem
 
Enterprise application environment
Enterprise application environmentEnterprise application environment
Enterprise application environment
 
Software testing
Software testingSoftware testing
Software testing
 

Recently uploaded

Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
Self-Control of Emotions by Slidesgo.pptx
Self-Control of Emotions by Slidesgo.pptxSelf-Control of Emotions by Slidesgo.pptx
Self-Control of Emotions by Slidesgo.pptx
iemerc2024
 
AIR POLLUTION lecture EnE203 updated.pdf
AIR POLLUTION lecture EnE203 updated.pdfAIR POLLUTION lecture EnE203 updated.pdf
AIR POLLUTION lecture EnE203 updated.pdf
RicletoEspinosa1
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Soumen Santra
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
obonagu
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
drwaing
 
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.pptPROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
bhadouriyakaku
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
Kamal Acharya
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
manasideore6
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
ChristineTorrepenida1
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
gestioneergodomus
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 

Recently uploaded (20)

Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
Self-Control of Emotions by Slidesgo.pptx
Self-Control of Emotions by Slidesgo.pptxSelf-Control of Emotions by Slidesgo.pptx
Self-Control of Emotions by Slidesgo.pptx
 
AIR POLLUTION lecture EnE203 updated.pdf
AIR POLLUTION lecture EnE203 updated.pdfAIR POLLUTION lecture EnE203 updated.pdf
AIR POLLUTION lecture EnE203 updated.pdf
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
 
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.pptPROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 

SQL : Structured Query Language

  • 1. By : Abhishek Gautam
  • 2.  SQL stands for Structured Query Language.  SQL is a database management language for relational databases.  SQL lets you access and manipulate databases.  SQL queries are not case sensitive. (SELECT = select)
  • 3.  Data Manipulation Language (DML) is used to add, update or delete data . Examples: INSERT, DELETE and UPDATE.  Data Definition Language (DDL) is used for managing tables and index structures. Examples: CREATE, ALTER,TRUNCATE and DROP.  Data Control Language (DCL) is used to assign and revoke database rights and permissions. Its main statements are GRANT and REVOKE.
  • 4.  SELECT - extracts data from a database  UPDATE - updates data in a database  DELETE - deletes data from a database  INSERT INTO - inserts new data into a database  CREATETABLE - creates a new table  ALTERTABLE - modifies a table  DROPTABLE - deletes a table
  • 5.  The CREATETABLE statement is used to create a table in a database.  CREATETABLE table_name( column_name1 data_type(size), column_name2 data_type(size), column_name3 data_type(size), .... );  E.g. : CREATETABLE People( ID int, FirstName varchar(255), LastName varchar(255), );
  • 6.  The INSERT INTO statement is used to insert new records in a table.  INSERT INTO table_name (column1, column2,..) VALUES ( Value1,Value2,…)  E.g. : INSERT INTO Customers(ID, FirstName, LastName) VALUES (1,’Abhi’,’Gautam’)
  • 7.  The UPDATE statement is used to update existing records in a table.  UPDATE table_name SET column1=value1,column2=value2,... WHERE some_column=some_value;  E.g. : UPDATE Customers SET FirstName =‘Abhishek' WHERE ID=1;
  • 8.  The DELETE statement is used to delete records in a table.  DELETE FROM table_name WHERE some_column=some_value;  E.g. : DELETE FROM Customers WHERE FirstName =‘Abhishek'
  • 9.  The ALTERTABLE statement is used to add, delete, or modify columns in an existing table.  ALTERTABLE table_name ADD column_name datatype  ALTERTABLE table_name DROP COLUMN column_name  ALTERTABLE table_name ALTER COLUMN column_name datatype
  • 10.  The DROPTABLE statement is used to delete an existing table.  DROPTABLETable_Name;  E.g. : DROPTABLE Customers;
  • 11.  SELECT * FROM table_name;  SELECT column_name,column_name FROM table_name;  E.g. : SELECT * FROM Customers; SELECT FirstName FROM Customers;
  • 12.  The SELECT DISTINCT statement is used to return only distinct (different) values.  SELECT DISTINCT column_name,column_name FROM table_name;  E.g. : SELECT DISTINCT FirstName FROM Customers;
  • 13.  The WHERE clause is used to filter records.  SELECT column_name,column_name FROM table_name WHERE column_name operator value;  E.g. : SELECT DISTINCT FirstName FROM People WHERE ID=5;
  • 14.  The AND operator displays a record if both the first condition AND the second condition are true.  The OR operator displays a record if either the first condition OR the second condition is true.  E.g. : SELECT * FROM Customers WHERE FirstName=‘Abhishek' AND LastName=‘Gautam';  SELECT * FROM Customers WHERE FirstName=‘Abhishek' OR LastName=‘Gautam';
  • 15.  GROUP BY clause is used to group the result based on the Column named in the GROUP BY clause.  SELECT Col_list FROM Table_Name WHERE where_condition GROUP BY col_list ;
  • 16.  ORDER BY clause is used to organize the result in ascending or descending order based on the Column named in the ORDER BY clause. Ascending order segregation is by default, to organize the result in descending order we have to use DESC clause.  SELECT Col_list FROMTable_Name WHERE where_condition GROUP BY col_list ORDER BY col_name DESC ;
  • 17.  JOIN clause is used to get result from two or more table which have a common column.  SELECT a.col_name,b.col_name FROM Table1_Name a JOIN Table2_Name b ON a.col_Name=b.col_Name;  INNER JOIN: Returns all rows when there is at least one match in BOTH tables  LEFT JOIN: Return all rows from the left table, and the matched rows from the right table  RIGHT JOIN: Return all rows from the right table, and the matched rows from the left table  FULL JOIN: Return all rows when there is a match inONE of the tables
  • 18.
  • 19.  User Defined functions  Built-in functions  COUNT()  MAX()  REPLACE()  SUBSTRING()