SlideShare a Scribd company logo
WELCOME
SQL Statements & Joins
Introduction
•SQL – Structured Query Language
•SQL lets you access and manipulate database
SQL Statements
•DDL - Data Definition Language
– Create, alter, drop,truncate…
•DML - Data Manipulation Language
– Insert, update, delete…
•DCL – Data Control Language
– grant, revoke
•DQL –Data Query Language
–select
DDL Statements
•Create - create database, table, view of table , or other
object in database
•Syntax -
CREATE DATABASE database_name;
CREATE TABLE table_name(column_name1 datatype,
column_name2 datatype,…..) PRIMARY KEY(column_name(s));
DDL Statements
•Drop - drop an existing database in SQL schema, drop a
table definition and all data…
•Syntax
DROP DATABASE database_name;
DROP TABLE table_name;
•Example:
•DROP TABLE tbl_students;
DDL Statements
•Alter - modifies an existing database object like table…
•Syntax -
•ALTER TABLE table_name
–ADD column_name datatype
–DROP COLUMN column_name
–MODIFY COLUMN column_name datatype
DDL Statements
•Truncate – delete complete data from an existing table
•Syntax
TRUNCATE TABLE table_name;
DML Statements
•Insert – creates a record
•Syntax -
INSERT INTO table_name(column_name1,column_name2….)
values(value1,value2….);
INSERT INTO table_name values(value1,value2….);
DML Statements
•Update – modify the existing records in a table
•Syntax
UPDATE TABLE table_name SET
column_name1=value1,….column_namen=valuen WHERE
[condition];
•Example:
UPDATE TABLE tbl_studetns SET student_place=‘Calicut’ WHERE
student_id=1;
DML Statements
•Delete – delete the existing records from a table
•Syntax
DELETE FROM table_name WHERE [condition];
•Example:
DELETE FROM tbl_students WHERE student_id=1;
DCL Statements
•Grant – gives a privilege to user
•Syntax -
GRANT privilege_name ON object_name
TO {user_name |PUBLIC |role_name} [WITH GRANT OPTION];
•Revoke- takes back proivilages granted from user
•syntax -
REVOKE privilege_name ON object_name FROM {user_name
|PUBLIC |role_name}
DQL – SELECT Statement
•Fetch the data from a database table which returns data in
the form of result table
•Syntax -
-select columns
SELECT column_name1, column_name2,…column_nameN
FROM table_name ;
-select all data from table
SELECT * FROM table_name;
DQL – SELECT Statement
•SELECT column_name1, column_name2,…column_nameN
FROM table_name WHERE [condition];
•Example:
•SELECT * FROM tbl_students;
•SELECT student_id,student_name FROM tbl_students;
•SELECT student_name FROM tbl_students WHERE student_id=1;
SQL Joins
•Combines two or more table , based on a common field
between them
•Different SQL Joins
–INNER JOIN
–LEFT JOIN
–RIGHT JOIN
–FULL JOIN
SQL Joins
•INNER JOIN - Returns all rows when there is at least one
match in BOTH tables
•Syntax -
SELECT column-name(s) FROM table_name1 INNER JOIN
table_name2 on table1.column_name=table2.column_name;
SQL Joins
•LEFT JOIN - Return all rows from the left table, and the
matched rows from the right table
•Syntax -
SELECT column-name(s) FROM table_name1 LEFT JOIN
table_name2 on table1.column_name=table2.column_name;
SELECT column_name(s) FROM table_name1 LEFT OUTER
JOIN table_name2
ON table1.column_name=table2.column_name;
SQL Joins
•RIGHT JOIN - Return all rows from the right table, and the
matched rows from the left table
•Syntax -
SELECT column-name(s) FROM table_name1 RIGHT JOIN
table_name2 on table1.column_name=table2.column_name;
SELECT column_name(s) FROM table_name1 RIGHT OUTER
JOIN table_name2 ON table1.column_name=table2.column_name;
SQL Joins
•FULL JOIN - Return all rows when there is a match in ONE
of the tables
•Syntax -
SELECT column-name(s) FROM table_name1 FULL OUTER JOIN
table_name2 on table1.column_name=table2.column_name;
sql statements & joins

More Related Content

What's hot

SQL-Alter Table, SELECT DISTINCT & WHERE
SQL-Alter Table, SELECT DISTINCT & WHERESQL-Alter Table, SELECT DISTINCT & WHERE
SQL-Alter Table, SELECT DISTINCT & WHERE
I L0V3 CODING DR
 
Oracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick Learning
Oracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick LearningOracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick Learning
Oracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick Learning
eVideoTuition
 
Sql basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statements
Mohd Tousif
 
SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)
Sharad Dubey
 
Oracle Database DML DDL and TCL
Oracle Database DML DDL and TCL Oracle Database DML DDL and TCL
Oracle Database DML DDL and TCL
Abdul Rehman
 
Sql commands
Sql commandsSql commands
Sql commands
Mohd Tousif
 
Ms sql-server
Ms sql-serverMs sql-server
Ms sql-server
Md.Mojibul Hoque
 
Sql basic things
Sql basic thingsSql basic things
Sql basic things
Nishil Jain
 
MySQL Essential Training
MySQL Essential TrainingMySQL Essential Training
MySQL Essential Training
HudaRaghibKadhim
 
An intoduction to sql and its components
An intoduction to sql and its componentsAn intoduction to sql and its components
An intoduction to sql and its components
Monika Jain DAIMSR
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
Pongsakorn U-chupala
 
DML Commands
DML CommandsDML Commands
Sql commands
Sql commandsSql commands
Sql – pocket guide
Sql – pocket guideSql – pocket guide
Sql – pocket guide
Santhosh Kumar
 
Group Members
Group MembersGroup Members
Group Members
Farhan Shahani
 
SQL Fundamentals - Lecture 2
SQL Fundamentals - Lecture 2SQL Fundamentals - Lecture 2
SQL Fundamentals - Lecture 2
MuhammadWaheed44
 
Database Architecture and Basic Concepts
Database Architecture and Basic ConceptsDatabase Architecture and Basic Concepts
Database Architecture and Basic Concepts
Tony Wong
 
Database Overview
Database OverviewDatabase Overview
Database Overview
Livares Technologies Pvt Ltd
 
SQL Basics
SQL BasicsSQL Basics
SQL Basics
Hammad Rasheed
 
Data Manipulation(DML) and Transaction Control (TCL)
Data Manipulation(DML) and Transaction Control (TCL)  Data Manipulation(DML) and Transaction Control (TCL)
Data Manipulation(DML) and Transaction Control (TCL)
MuhammadWaheed44
 

What's hot (20)

SQL-Alter Table, SELECT DISTINCT & WHERE
SQL-Alter Table, SELECT DISTINCT & WHERESQL-Alter Table, SELECT DISTINCT & WHERE
SQL-Alter Table, SELECT DISTINCT & WHERE
 
Oracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick Learning
Oracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick LearningOracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick Learning
Oracle/SQL For Beginners - DDL | DML | DCL | TCL - Quick Learning
 
Sql basics and DDL statements
Sql basics and DDL statementsSql basics and DDL statements
Sql basics and DDL statements
 
SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)
 
Oracle Database DML DDL and TCL
Oracle Database DML DDL and TCL Oracle Database DML DDL and TCL
Oracle Database DML DDL and TCL
 
Sql commands
Sql commandsSql commands
Sql commands
 
Ms sql-server
Ms sql-serverMs sql-server
Ms sql-server
 
Sql basic things
Sql basic thingsSql basic things
Sql basic things
 
MySQL Essential Training
MySQL Essential TrainingMySQL Essential Training
MySQL Essential Training
 
An intoduction to sql and its components
An intoduction to sql and its componentsAn intoduction to sql and its components
An intoduction to sql and its components
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
 
DML Commands
DML CommandsDML Commands
DML Commands
 
Sql commands
Sql commandsSql commands
Sql commands
 
Sql – pocket guide
Sql – pocket guideSql – pocket guide
Sql – pocket guide
 
Group Members
Group MembersGroup Members
Group Members
 
SQL Fundamentals - Lecture 2
SQL Fundamentals - Lecture 2SQL Fundamentals - Lecture 2
SQL Fundamentals - Lecture 2
 
Database Architecture and Basic Concepts
Database Architecture and Basic ConceptsDatabase Architecture and Basic Concepts
Database Architecture and Basic Concepts
 
Database Overview
Database OverviewDatabase Overview
Database Overview
 
SQL Basics
SQL BasicsSQL Basics
SQL Basics
 
Data Manipulation(DML) and Transaction Control (TCL)
Data Manipulation(DML) and Transaction Control (TCL)  Data Manipulation(DML) and Transaction Control (TCL)
Data Manipulation(DML) and Transaction Control (TCL)
 

Viewers also liked

Karan normalization in sql
Karan normalization in sqlKaran normalization in sql
Karan normalization in sql
KARANKOTECHA123
 
BCA GGSIPU NEW SYALLBUS
BCA GGSIPU NEW SYALLBUSBCA GGSIPU NEW SYALLBUS
Database - SQL Joins
Database - SQL JoinsDatabase - SQL Joins
Database - SQL Joins
Mudasir Qazi
 
Introduction to sql database on azure
Introduction to sql database on azureIntroduction to sql database on azure
Introduction to sql database on azure
Antonios Chatzipavlis
 
Everything about Database JOINS and Relationships
Everything about Database JOINS and RelationshipsEverything about Database JOINS and Relationships
Everything about Database JOINS and Relationships
Abdul Rahman Sherzad
 
Types Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql ServerTypes Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql Server
programmings guru
 
Joins – which, when and why
Joins – which, when and whyJoins – which, when and why
Joins – which, when and why
Michal Simonik
 
DBMS Practical File
DBMS Practical FileDBMS Practical File
DBMS Practical File
Dushmanta Nath
 
Oracle Sql Tuning
Oracle Sql TuningOracle Sql Tuning
Oracle Sql Tuning
Chris Adkin
 
Slideshare ppt
Slideshare pptSlideshare ppt
Slideshare ppt
Mandy Suzanne
 

Viewers also liked (10)

Karan normalization in sql
Karan normalization in sqlKaran normalization in sql
Karan normalization in sql
 
BCA GGSIPU NEW SYALLBUS
BCA GGSIPU NEW SYALLBUSBCA GGSIPU NEW SYALLBUS
BCA GGSIPU NEW SYALLBUS
 
Database - SQL Joins
Database - SQL JoinsDatabase - SQL Joins
Database - SQL Joins
 
Introduction to sql database on azure
Introduction to sql database on azureIntroduction to sql database on azure
Introduction to sql database on azure
 
Everything about Database JOINS and Relationships
Everything about Database JOINS and RelationshipsEverything about Database JOINS and Relationships
Everything about Database JOINS and Relationships
 
Types Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql ServerTypes Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql Server
 
Joins – which, when and why
Joins – which, when and whyJoins – which, when and why
Joins – which, when and why
 
DBMS Practical File
DBMS Practical FileDBMS Practical File
DBMS Practical File
 
Oracle Sql Tuning
Oracle Sql TuningOracle Sql Tuning
Oracle Sql Tuning
 
Slideshare ppt
Slideshare pptSlideshare ppt
Slideshare ppt
 

Similar to sql statements & joins

Unit - II.pptx
Unit - II.pptxUnit - II.pptx
Unit - II.pptx
MrsSavitaKumbhare
 
Himani uppal-221302130 WP ppt.pptx
Himani uppal-221302130  WP ppt.pptxHimani uppal-221302130  WP ppt.pptx
Himani uppal-221302130 WP ppt.pptx
MohitYadav889220
 
Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.ppt
DrRShaliniVISTAS
 
SQL: Introduction and its Basic Commands
SQL: Introduction and its Basic CommandsSQL: Introduction and its Basic Commands
SQL: Introduction and its Basic Commands
niyantadesai7
 
ppt.pdf
ppt.pdfppt.pdf
ppt.pdf
BrahmamKolli
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
Shrija Madhu
 
COMMANDS PPT(1).pdf
COMMANDS PPT(1).pdfCOMMANDS PPT(1).pdf
COMMANDS PPT(1).pdf
BrahmamKolli
 
COMPUTERS SQL
COMPUTERS SQL COMPUTERS SQL
COMPUTERS SQL
Rc Os
 
DDL(Data defination Language ) Using Oracle
DDL(Data defination Language ) Using OracleDDL(Data defination Language ) Using Oracle
DDL(Data defination Language ) Using Oracle
Farhan Aslam
 
Mysql-overview.pptx
Mysql-overview.pptxMysql-overview.pptx
Mysql-overview.pptx
TamilHunt
 
Rdbms day3
Rdbms day3Rdbms day3
Rdbms day3
Nitesh Singh
 
Sql statements function join
Sql statements function joinSql statements function join
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slides
metsarin
 
MS SQL - Database Programming Concepts by RSolutions
MS SQL - Database Programming Concepts by RSolutionsMS SQL - Database Programming Concepts by RSolutions
MS SQL - Database Programming Concepts by RSolutions
RSolutions
 
Lab2 ddl commands
Lab2 ddl commandsLab2 ddl commands
Lab2 ddl commands
Balqees Al.Mubarak
 
Lesson-02 (1).pptx
Lesson-02 (1).pptxLesson-02 (1).pptx
Lesson-02 (1).pptx
ssuserc24e05
 
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with ExamplesDML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
SQL Basic Clause - Portfolio.pptx
SQL Basic Clause - Portfolio.pptxSQL Basic Clause - Portfolio.pptx
SQL Basic Clause - Portfolio.pptx
Elyada Wigati Pramaresti
 
IM02: Database Language
IM02: Database LanguageIM02: Database Language
IM02: Database Language
Kelvin Chan
 
SQL_NOTES.pdf
SQL_NOTES.pdfSQL_NOTES.pdf
SQL_NOTES.pdf
AnshumanDwivedi14
 

Similar to sql statements & joins (20)

Unit - II.pptx
Unit - II.pptxUnit - II.pptx
Unit - II.pptx
 
Himani uppal-221302130 WP ppt.pptx
Himani uppal-221302130  WP ppt.pptxHimani uppal-221302130  WP ppt.pptx
Himani uppal-221302130 WP ppt.pptx
 
Sql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.pptSql Commands_Dr.R.Shalini.ppt
Sql Commands_Dr.R.Shalini.ppt
 
SQL: Introduction and its Basic Commands
SQL: Introduction and its Basic CommandsSQL: Introduction and its Basic Commands
SQL: Introduction and its Basic Commands
 
ppt.pdf
ppt.pdfppt.pdf
ppt.pdf
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
 
COMMANDS PPT(1).pdf
COMMANDS PPT(1).pdfCOMMANDS PPT(1).pdf
COMMANDS PPT(1).pdf
 
COMPUTERS SQL
COMPUTERS SQL COMPUTERS SQL
COMPUTERS SQL
 
DDL(Data defination Language ) Using Oracle
DDL(Data defination Language ) Using OracleDDL(Data defination Language ) Using Oracle
DDL(Data defination Language ) Using Oracle
 
Mysql-overview.pptx
Mysql-overview.pptxMysql-overview.pptx
Mysql-overview.pptx
 
Rdbms day3
Rdbms day3Rdbms day3
Rdbms day3
 
Sql statements function join
Sql statements function joinSql statements function join
Sql statements function join
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slides
 
MS SQL - Database Programming Concepts by RSolutions
MS SQL - Database Programming Concepts by RSolutionsMS SQL - Database Programming Concepts by RSolutions
MS SQL - Database Programming Concepts by RSolutions
 
Lab2 ddl commands
Lab2 ddl commandsLab2 ddl commands
Lab2 ddl commands
 
Lesson-02 (1).pptx
Lesson-02 (1).pptxLesson-02 (1).pptx
Lesson-02 (1).pptx
 
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with ExamplesDML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
 
SQL Basic Clause - Portfolio.pptx
SQL Basic Clause - Portfolio.pptxSQL Basic Clause - Portfolio.pptx
SQL Basic Clause - Portfolio.pptx
 
IM02: Database Language
IM02: Database LanguageIM02: Database Language
IM02: Database Language
 
SQL_NOTES.pdf
SQL_NOTES.pdfSQL_NOTES.pdf
SQL_NOTES.pdf
 

Recently uploaded

A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
kalichargn70th171
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
Optimizing Your E-commerce with WooCommerce.pptx
Optimizing Your E-commerce with WooCommerce.pptxOptimizing Your E-commerce with WooCommerce.pptx
Optimizing Your E-commerce with WooCommerce.pptx
WebConnect Pvt Ltd
 
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
kalichargn70th171
 
TMU毕业证书精仿办理
TMU毕业证书精仿办理TMU毕业证书精仿办理
TMU毕业证书精仿办理
aeeva
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Peter Caitens
 
What is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdfWhat is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdf
kalichargn70th171
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio, Inc.
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid
 
Building API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructureBuilding API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructure
confluent
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.
Maitrey Patel
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
Bert Jan Schrijver
 
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptxOperational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
sandeepmenon62
 
Voxxed Days Trieste 2024 - Unleashing the Power of Vector Search and Semantic...
Voxxed Days Trieste 2024 - Unleashing the Power of Vector Search and Semantic...Voxxed Days Trieste 2024 - Unleashing the Power of Vector Search and Semantic...
Voxxed Days Trieste 2024 - Unleashing the Power of Vector Search and Semantic...
Luigi Fugaro
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
kgyxske
 
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and MoreManyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
narinav14
 
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdfThe Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
kalichargn70th171
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 

Recently uploaded (20)

A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
Optimizing Your E-commerce with WooCommerce.pptx
Optimizing Your E-commerce with WooCommerce.pptxOptimizing Your E-commerce with WooCommerce.pptx
Optimizing Your E-commerce with WooCommerce.pptx
 
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
 
TMU毕业证书精仿办理
TMU毕业证书精仿办理TMU毕业证书精仿办理
TMU毕业证书精仿办理
 
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom KittEnhanced Screen Flows UI/UX using SLDS with Tom Kitt
Enhanced Screen Flows UI/UX using SLDS with Tom Kitt
 
What is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdfWhat is Continuous Testing in DevOps - A Definitive Guide.pdf
What is Continuous Testing in DevOps - A Definitive Guide.pdf
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
 
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdfBaha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
Baha Majid WCA4Z IBM Z Customer Council Boston June 2024.pdf
 
Building API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructureBuilding API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructure
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.ACE - Team 24 Wrapup event at ahmedabad.
ACE - Team 24 Wrapup event at ahmedabad.
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
 
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptxOperational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
Operational ease MuleSoft and Salesforce Service Cloud Solution v1.0.pptx
 
bgiolcb
bgiolcbbgiolcb
bgiolcb
 
Voxxed Days Trieste 2024 - Unleashing the Power of Vector Search and Semantic...
Voxxed Days Trieste 2024 - Unleashing the Power of Vector Search and Semantic...Voxxed Days Trieste 2024 - Unleashing the Power of Vector Search and Semantic...
Voxxed Days Trieste 2024 - Unleashing the Power of Vector Search and Semantic...
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
 
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and MoreManyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
 
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdfThe Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 

sql statements & joins

  • 3. Introduction •SQL – Structured Query Language •SQL lets you access and manipulate database
  • 4. SQL Statements •DDL - Data Definition Language – Create, alter, drop,truncate… •DML - Data Manipulation Language – Insert, update, delete… •DCL – Data Control Language – grant, revoke •DQL –Data Query Language –select
  • 5. DDL Statements •Create - create database, table, view of table , or other object in database •Syntax - CREATE DATABASE database_name; CREATE TABLE table_name(column_name1 datatype, column_name2 datatype,…..) PRIMARY KEY(column_name(s));
  • 6. DDL Statements •Drop - drop an existing database in SQL schema, drop a table definition and all data… •Syntax DROP DATABASE database_name; DROP TABLE table_name; •Example: •DROP TABLE tbl_students;
  • 7. DDL Statements •Alter - modifies an existing database object like table… •Syntax - •ALTER TABLE table_name –ADD column_name datatype –DROP COLUMN column_name –MODIFY COLUMN column_name datatype
  • 8. DDL Statements •Truncate – delete complete data from an existing table •Syntax TRUNCATE TABLE table_name;
  • 9. DML Statements •Insert – creates a record •Syntax - INSERT INTO table_name(column_name1,column_name2….) values(value1,value2….); INSERT INTO table_name values(value1,value2….);
  • 10. DML Statements •Update – modify the existing records in a table •Syntax UPDATE TABLE table_name SET column_name1=value1,….column_namen=valuen WHERE [condition]; •Example: UPDATE TABLE tbl_studetns SET student_place=‘Calicut’ WHERE student_id=1;
  • 11. DML Statements •Delete – delete the existing records from a table •Syntax DELETE FROM table_name WHERE [condition]; •Example: DELETE FROM tbl_students WHERE student_id=1;
  • 12. DCL Statements •Grant – gives a privilege to user •Syntax - GRANT privilege_name ON object_name TO {user_name |PUBLIC |role_name} [WITH GRANT OPTION]; •Revoke- takes back proivilages granted from user •syntax - REVOKE privilege_name ON object_name FROM {user_name |PUBLIC |role_name}
  • 13. DQL – SELECT Statement •Fetch the data from a database table which returns data in the form of result table •Syntax - -select columns SELECT column_name1, column_name2,…column_nameN FROM table_name ; -select all data from table SELECT * FROM table_name;
  • 14. DQL – SELECT Statement •SELECT column_name1, column_name2,…column_nameN FROM table_name WHERE [condition]; •Example: •SELECT * FROM tbl_students; •SELECT student_id,student_name FROM tbl_students; •SELECT student_name FROM tbl_students WHERE student_id=1;
  • 15. SQL Joins •Combines two or more table , based on a common field between them •Different SQL Joins –INNER JOIN –LEFT JOIN –RIGHT JOIN –FULL JOIN
  • 16. SQL Joins •INNER JOIN - Returns all rows when there is at least one match in BOTH tables •Syntax - SELECT column-name(s) FROM table_name1 INNER JOIN table_name2 on table1.column_name=table2.column_name;
  • 17. SQL Joins •LEFT JOIN - Return all rows from the left table, and the matched rows from the right table •Syntax - SELECT column-name(s) FROM table_name1 LEFT JOIN table_name2 on table1.column_name=table2.column_name; SELECT column_name(s) FROM table_name1 LEFT OUTER JOIN table_name2 ON table1.column_name=table2.column_name;
  • 18. SQL Joins •RIGHT JOIN - Return all rows from the right table, and the matched rows from the left table •Syntax - SELECT column-name(s) FROM table_name1 RIGHT JOIN table_name2 on table1.column_name=table2.column_name; SELECT column_name(s) FROM table_name1 RIGHT OUTER JOIN table_name2 ON table1.column_name=table2.column_name;
  • 19. SQL Joins •FULL JOIN - Return all rows when there is a match in ONE of the tables •Syntax - SELECT column-name(s) FROM table_name1 FULL OUTER JOIN table_name2 on table1.column_name=table2.column_name;