SlideShare a Scribd company logo
1 of 41
SQL Online
Training
Organized collection of structured
information, or data, typically stored
electronically
Database
Uses of Database
• Databases can store very large
numbers of records efficiently (they
take up little space).
• It is very quick and easy to find
information.
• It is easy to add new data and to edit
or delete old data.
• Data sharing. Fast and efficient
collaboration between users.
• Data access and auditing. Controlled
access to databases.
What's SQL?
Structured Query Language
SQL (Structured Query Language) is a standardized programming language
that's used to manage relational databases and perform various operations
on the data in them.
SQL is not a database system, but it is a query
language.
What's is relational
database?
RDBMS
Relational Database Management System
An RDBMS is a type of database management system (DBMS)
that stores data in a row-based table structure which
connects related data elements.
Why RDBMS?
An RDBMS includes functions that maintain the security,
accuracy, integrity and consistency of the data.
Examples
Examples of the most popular RDBMS are MYSQL, Oracle,
IBM DB2, and Microsoft SQL Server database.
Basic concepts of SQL
SQL CREATE DATABASE
The CREATE DATABASE statement is used to create a new SQL
database.
CREATE DATABASE
databasename;
SQL CREATE TABLE
The CREATE TABLE statement is used to create a new table in a
database.
CREATE TABLE table_name (
column1 datatype,
column2 datatype,
column3 datatype,
....
);
The column parameters specify the names of the
columns of the table. The datatype parameter
specifies the type of data the column can hold
(e.g. varchar, integer, date, etc.).
SQL INSERT INTO
The INSERT INTO statement is used to insert new records in a table.
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
Specify both the column names and the values to
be inserted, when you are targeting only specific
ones.
INSERT INTO table_name
VALUES (value1, value2, value3, ...);
If you are adding values for all the columns of the
table, you do not need to specify the column
names in the SQL query
How to display?
USING SQL SELECT
The SELECT statement is used to select data from a database. The
data returned is stored in a result table, called the result-set.
SELECT column1, column2, ...
FROM table_name;
Specify both the column names, when you are
targeting only specific ones.
SELECT * FROM table_name;
If you want to select all the fields available in the
table, use *
USING SQL SELECT DISTINCT
The SELECT DISTINCT statement is used to return only distinct
(different) values.
SELECT DISTINCT column1, column2, ...
FROM table_name;
Specify column names, when you are targeting
only specific ones.
SELECT DISTINCT * FROM table_name;
If you want to select all the fields available in the
table, use *
USING SQL WHERE
The WHERE clause is used to filter records.
SELECT column1, column2, ...
FROM table_name
WHERE condition;
Specify column names, when you are targeting
only specific ones.
SELECT * FROM table_name WHERE
condition;
If you want to select all the fields available in the
table, use *
SQL UPDATE
The UPDATE statement is used to modify the existing records in a
table.
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
Be careful when updating records in a table! Notice the WHERE clause in the UPDATE
statement. The WHERE clause specifies which record(s) that should be updated. If you omit
the WHERE clause, all records in the table will be updated!
SQL DELETE
The DELETE statement is used to delete existing records in a table.
DELETE FROM table_name WHERE condition;
Be careful when deleting records in a table! Notice the WHERE clause in the DELETE
statement. The WHERE clause specifies which record(s) should be deleted. If you omit the
WHERE clause, all records in the table will be deleted!
How to assign multiple
conditions?
Use operators!!
USING SQL AND operator
The AND operator displays a record if all the conditions separated by
AND are TRUE.
SELECT column1, column2, ...
FROM table_name
WHERE condition1 AND condition2 OR condition3 ...;
The AND operator is used to filter records based on more than one condition
USING SQL OR operator
The OR operator displays a record if any of the conditions separated
by OR is TRUE.
SELECT column1, column2, ...
FROM table_name
WHERE condition1 OR condition2 OR condition3 ...;
The OR operator is used to filter records based on more than one condition
USING SQL NOT operator
The NOT operator displays a record if the condition(s) is NOT TRUE.
SELECT column1, column2, ...
FROM table_name
WHERE NOT condition;
The NOT operator is used to filter records when conditions turns out to be False!
How to delete a table?
SQL DROP TABLE
The DROP TABLE statement is used to drop an existing table in a
database.
DROP TABLE table_name;
Be careful before dropping a table. Deleting a table will result in loss of complete information
stored in the table!
How to delete a
database?
SQL DROP DATABASE
The DROP DATABASE statement is used to drop an existing SQL
database.
DROP DATABASE databasename;
Be careful before dropping a database. Deleting a database will result in loss of complete
information stored in the database!
MySQL
Database
MySQL is a relational database management
system based on SQL – Structured Query
Language.
Quiz session
Full form of SQL
Drop your answers
Full form of SQL
Structured Query Language
Full form of DBMS
Drop your answers
Full form of DBMS
Database Management System
Full form of RDBMS
Drop your answers
Full form of RDBMS
Relational Database Management System
CREATE TABLE StudentData(
regNo int,
StudentName varchar(255)
);
INSERT INTO StudentData VALUES (1234, "Abc");
UPDATE StudentData SET StudentName="Cde" WHERE regNo=1234;
SELECT * FROM StudentData;
What's the output?
CREATE TABLE StudentData(
regNo int,
StudentName varchar(255)
);
INSERT INTO StudentData VALUES (1234, "Abc");
UPDATE StudentData SET StudentName="Cde" WHERE regNo=1234;
SELECT * FROM StudentData;
Abc changes to Cde
Thank you!

More Related Content

Similar to SQL | DML

SQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdfSQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdf
DraguClaudiu
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
EliasPetros
 

Similar to SQL | DML (20)

Relational Database Language.pptx
Relational Database Language.pptxRelational Database Language.pptx
Relational Database Language.pptx
 
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 introduction
Sql introductionSql introduction
Sql introduction
 
Sql basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statements
 
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...
 
COMPUTERS SQL
COMPUTERS SQL COMPUTERS SQL
COMPUTERS SQL
 
Introduction to SQL..pdf
Introduction to SQL..pdfIntroduction to SQL..pdf
Introduction to SQL..pdf
 
2..basic queries.pptx
2..basic queries.pptx2..basic queries.pptx
2..basic queries.pptx
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
 
SQL interview questions by jeetendra mandal - part 3
SQL interview questions by jeetendra mandal - part 3SQL interview questions by jeetendra mandal - part 3
SQL interview questions by jeetendra mandal - part 3
 
SQL interview questions by Jeetendra Mandal - part 2
SQL interview questions by Jeetendra Mandal - part 2SQL interview questions by Jeetendra Mandal - part 2
SQL interview questions by Jeetendra Mandal - part 2
 
Sql commands
Sql commandsSql commands
Sql commands
 
Lab2 ddl commands
Lab2 ddl commandsLab2 ddl commands
Lab2 ddl commands
 
SQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdfSQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdf
 
MySQL Essential Training
MySQL Essential TrainingMySQL Essential Training
MySQL Essential Training
 
about-SQL AND ETC.pptx
about-SQL AND ETC.pptxabout-SQL AND ETC.pptx
about-SQL AND ETC.pptx
 
MySQL.pptx comuterscience from kvsbbsrs.
MySQL.pptx comuterscience from kvsbbsrs.MySQL.pptx comuterscience from kvsbbsrs.
MySQL.pptx comuterscience from kvsbbsrs.
 
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptxMy lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
My lablkxjlkxjcvlxkcjvlxckjvlxck ppt.pptx
 
MySQL notes - Basic Commands and Definitions
MySQL notes - Basic Commands and DefinitionsMySQL notes - Basic Commands and Definitions
MySQL notes - Basic Commands and Definitions
 

More from To Sum It Up

More from To Sum It Up (20)

Prompt Engineering | Beginner's Guide - For You
Prompt Engineering | Beginner's Guide - For YouPrompt Engineering | Beginner's Guide - For You
Prompt Engineering | Beginner's Guide - For You
 
Natural Language Processing (NLP) | Basics
Natural Language Processing (NLP) | BasicsNatural Language Processing (NLP) | Basics
Natural Language Processing (NLP) | Basics
 
It's Machine Learning Basics -- For You!
It's Machine Learning Basics -- For You!It's Machine Learning Basics -- For You!
It's Machine Learning Basics -- For You!
 
Polymorphism in Python
Polymorphism in PythonPolymorphism in Python
Polymorphism in Python
 
DSA Question Bank
DSA Question BankDSA Question Bank
DSA Question Bank
 
Web API - Overview
Web API - OverviewWeb API - Overview
Web API - Overview
 
CSS Overview
CSS OverviewCSS Overview
CSS Overview
 
HTML Overview
HTML OverviewHTML Overview
HTML Overview
 
EM Algorithm
EM AlgorithmEM Algorithm
EM Algorithm
 
User story mapping
User story mappingUser story mapping
User story mapping
 
User stories
User storiesUser stories
User stories
 
Problem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study materialProblem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study material
 
Problem solving using computers - Chapter 1
Problem solving using computers - Chapter 1 Problem solving using computers - Chapter 1
Problem solving using computers - Chapter 1
 
Quality Circle | Case Study on Self Esteem | Team Opus Geeks.pdf
Quality Circle | Case Study on Self Esteem | Team Opus Geeks.pdfQuality Circle | Case Study on Self Esteem | Team Opus Geeks.pdf
Quality Circle | Case Study on Self Esteem | Team Opus Geeks.pdf
 
Multimedia Content and Content Acquisition
Multimedia Content and Content AcquisitionMultimedia Content and Content Acquisition
Multimedia Content and Content Acquisition
 
PHP Arrays_Introduction
PHP Arrays_IntroductionPHP Arrays_Introduction
PHP Arrays_Introduction
 
System Calls - Introduction
System Calls - IntroductionSystem Calls - Introduction
System Calls - Introduction
 
Leadership
LeadershipLeadership
Leadership
 
Programming The Basic Computer
Programming The Basic ComputerProgramming The Basic Computer
Programming The Basic Computer
 
Ozone in wastewater treatment
Ozone in wastewater treatmentOzone in wastewater treatment
Ozone in wastewater treatment
 

Recently uploaded

Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 

Recently uploaded (20)

WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 

SQL | DML

  • 2. Organized collection of structured information, or data, typically stored electronically Database
  • 4. • Databases can store very large numbers of records efficiently (they take up little space). • It is very quick and easy to find information. • It is easy to add new data and to edit or delete old data. • Data sharing. Fast and efficient collaboration between users. • Data access and auditing. Controlled access to databases.
  • 7. SQL (Structured Query Language) is a standardized programming language that's used to manage relational databases and perform various operations on the data in them.
  • 8. SQL is not a database system, but it is a query language.
  • 10. RDBMS Relational Database Management System An RDBMS is a type of database management system (DBMS) that stores data in a row-based table structure which connects related data elements. Why RDBMS? An RDBMS includes functions that maintain the security, accuracy, integrity and consistency of the data. Examples Examples of the most popular RDBMS are MYSQL, Oracle, IBM DB2, and Microsoft SQL Server database.
  • 12. SQL CREATE DATABASE The CREATE DATABASE statement is used to create a new SQL database. CREATE DATABASE databasename;
  • 13. SQL CREATE TABLE The CREATE TABLE statement is used to create a new table in a database. CREATE TABLE table_name ( column1 datatype, column2 datatype, column3 datatype, .... ); The column parameters specify the names of the columns of the table. The datatype parameter specifies the type of data the column can hold (e.g. varchar, integer, date, etc.).
  • 14. SQL INSERT INTO The INSERT INTO statement is used to insert new records in a table. INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...); Specify both the column names and the values to be inserted, when you are targeting only specific ones. INSERT INTO table_name VALUES (value1, value2, value3, ...); If you are adding values for all the columns of the table, you do not need to specify the column names in the SQL query
  • 16. USING SQL SELECT The SELECT statement is used to select data from a database. The data returned is stored in a result table, called the result-set. SELECT column1, column2, ... FROM table_name; Specify both the column names, when you are targeting only specific ones. SELECT * FROM table_name; If you want to select all the fields available in the table, use *
  • 17. USING SQL SELECT DISTINCT The SELECT DISTINCT statement is used to return only distinct (different) values. SELECT DISTINCT column1, column2, ... FROM table_name; Specify column names, when you are targeting only specific ones. SELECT DISTINCT * FROM table_name; If you want to select all the fields available in the table, use *
  • 18. USING SQL WHERE The WHERE clause is used to filter records. SELECT column1, column2, ... FROM table_name WHERE condition; Specify column names, when you are targeting only specific ones. SELECT * FROM table_name WHERE condition; If you want to select all the fields available in the table, use *
  • 19. SQL UPDATE The UPDATE statement is used to modify the existing records in a table. UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE condition; Be careful when updating records in a table! Notice the WHERE clause in the UPDATE statement. The WHERE clause specifies which record(s) that should be updated. If you omit the WHERE clause, all records in the table will be updated!
  • 20. SQL DELETE The DELETE statement is used to delete existing records in a table. DELETE FROM table_name WHERE condition; Be careful when deleting records in a table! Notice the WHERE clause in the DELETE statement. The WHERE clause specifies which record(s) should be deleted. If you omit the WHERE clause, all records in the table will be deleted!
  • 21. How to assign multiple conditions?
  • 23. USING SQL AND operator The AND operator displays a record if all the conditions separated by AND are TRUE. SELECT column1, column2, ... FROM table_name WHERE condition1 AND condition2 OR condition3 ...; The AND operator is used to filter records based on more than one condition
  • 24. USING SQL OR operator The OR operator displays a record if any of the conditions separated by OR is TRUE. SELECT column1, column2, ... FROM table_name WHERE condition1 OR condition2 OR condition3 ...; The OR operator is used to filter records based on more than one condition
  • 25. USING SQL NOT operator The NOT operator displays a record if the condition(s) is NOT TRUE. SELECT column1, column2, ... FROM table_name WHERE NOT condition; The NOT operator is used to filter records when conditions turns out to be False!
  • 26. How to delete a table?
  • 27. SQL DROP TABLE The DROP TABLE statement is used to drop an existing table in a database. DROP TABLE table_name; Be careful before dropping a table. Deleting a table will result in loss of complete information stored in the table!
  • 28. How to delete a database?
  • 29. SQL DROP DATABASE The DROP DATABASE statement is used to drop an existing SQL database. DROP DATABASE databasename; Be careful before dropping a database. Deleting a database will result in loss of complete information stored in the database!
  • 31. MySQL is a relational database management system based on SQL – Structured Query Language.
  • 33. Full form of SQL Drop your answers
  • 34. Full form of SQL Structured Query Language
  • 35. Full form of DBMS Drop your answers
  • 36. Full form of DBMS Database Management System
  • 37. Full form of RDBMS Drop your answers
  • 38. Full form of RDBMS Relational Database Management System
  • 39. CREATE TABLE StudentData( regNo int, StudentName varchar(255) ); INSERT INTO StudentData VALUES (1234, "Abc"); UPDATE StudentData SET StudentName="Cde" WHERE regNo=1234; SELECT * FROM StudentData; What's the output?
  • 40. CREATE TABLE StudentData( regNo int, StudentName varchar(255) ); INSERT INTO StudentData VALUES (1234, "Abc"); UPDATE StudentData SET StudentName="Cde" WHERE regNo=1234; SELECT * FROM StudentData; Abc changes to Cde