SlideShare a Scribd company logo
SQL – Structured Query Language By: - Vikash Pandey Roll No: - 43 Bhavan’s Institute of Mgmt. Science 2008-2010
What is SQL? SQL stands for Structured Query Language. SQL lets you access and manipulate databases. SQL is an ANSI (American National Standards Institute) standard.
What Can SQL do? SQL can execute queries against a database. SQL can retrieve data from a database. SQL can insert records in a database. SQL can update records in a database. SQL can delete records from a database. SQL can create new databases. SQL can create new tables in a database. SQL can create stored procedures in a database. SQL can create views in a database. SQL can set permissions on tables, procedures, and views.
SQL is a Standard - BUT.... Although SQL is an ANSI (American National Standards Institute) standard, there are many different versions of the SQL language. However, to be compliant with the ANSI standard, they all support at least the major commands (such as SELECT, UPDATE, DELETE, INSERT, WHERE) in a similar manner.
SQL DML & DDL SQL can be divided into two parts: The Data Manipulation Language (DML) and the Data Definition Language (DDL). The query and update commands form the DML part of SQL: 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
The DDL part of SQL permits database tables to be created or deleted. It also define indexes (keys), specify links between tables, and impose constraints between tables. The most important DDL statements in SQL are: CREATE DATABASE  - creates a new database ALTER DATABASE  - modifies a database CREATE TABLE  - creates a new table ALTER TABLE  - modifies a table DROP TABLE  - deletes a table CREATE INDEX  - creates an index (search key) DROP INDEX  - deletes an index
The SQL SELECT Statement The SELECT statement is used to select data from a database. The result is stored in a result table, called the result-set. SQL SELECT Syntax SELECT column_name(s) FROM table_name and SELECT * FROM table_name Note:  SQL is not case sensitive. SELECT is the same as select
Example: - Now we want to select the content of the columns named "LastName" and "FirstName" from the table above. We use the following SELECT statement: SELECT LastName,FirstName FROM Persons The result-set will look like this: P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai
Last Name First Name Das Sirsendu Ray Roshni Banerjee Saurav
SELECT * Example Now we want to select  all  the columns from the "Persons" table. We use the following SELECT statement:  SELECT * FROM Persons  Tip:  The asterisk (*) is a quick way of selecting all columns! The result-set will look like this: P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai
SQL UPDATE Statement The UPDATE statement is used to update existing records in a table. SQL UPDATE Syntax UPDATE table_name SET column1=value, column2=value2,... WHERE some_column=some_value  Note:  Notice the WHERE clause in the UPDATE syntax. The WHERE clause specifies which record or records that should be updated. If you omit the WHERE clause, all records will be updated!
Example: - We use the following SQL statement: Now we want to update the person “Sinha, Joyeeti" in the "Persons" table. UPDATE Persons SET Address=‘Ernakulam', City=‘Chennai’ WHERE LastName=‘Sinha' AND FirstName='Joyeeti' P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai 4 Sinha Joyeeti
The "Persons" table will now look like this: P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai 4 Sinha Joyeeti Ernakulam Chennai
SQL DELETE Statement The DELETE statement is used to delete rows in a table. SQL DELETE Syntax DELETE FROM table_name WHERE some_column=some_value  Note:  Notice the WHERE clause in the DELETE syntax. The WHERE clause specifies which record or records that should be deleted. If you omit the WHERE clause, all records will be deleted!
Example: - We use the following SQL statement: Now we want to delete the person “Sinha, Joyeeti" in the "Persons" table. DELETE FROM Persons WHERE LastName=‘Sinha' AND FirstName='Joyeeti' P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai 4 Sinha Joyeeti Ernakulam Chennai
It is possible to delete all rows in a table without deleting the table. This means that the table structure, attributes, and indexes will be intact: DELETE FROM table_name or DELETE * FROM table_name P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai
SQL INSERT INTO Statement The INSERT INTO statement is used to insert a new row in a table. SQL INSERT INTO Syntax It is possible to write the INSERT INTO statement in two forms.  The first form doesn't specify the column names where the data will be inserted, only their values: INSERT INTO table_name VALUES (value1, value2, value3,...) The second form specifies both the column names and the values to be inserted: INSERT INTO table_name (column1, column2, column3,...) VALUES (value1, value2, value3,...)
Example We have the following “Persons” table: - Now we want to insert a new row in the "Persons" table. We use the following SQL statement: INSERT INTO Persons VALUES (4,‘Sinha', 'Joyeeti', ‘Ernakulam', ‘Chennai') P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai
The table would look like: - P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai 4 Sinha Joyeeti Ernakulam Chennai
INSERT Data Only In Specified Columns It is also possible to only add data in specific columns. The following SQL statement will add a new row, but only add data in the "P_Id", "LastName" and the "FirstName" columns: INSERT INTO Persons (P_Id, LastName, FirstName) VALUES (5, ‘Das', ‘Kaustav') P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai 4 Sinha Joyeeti Ernakulam Chennai 5 Das Kaustav
Ad

More Related Content

What's hot (20)

Group By, Order By, and Aliases in SQL
Group By, Order By, and Aliases in SQLGroup By, Order By, and Aliases in SQL
Group By, Order By, and Aliases in SQL
MSB Academy
 
Aggregate functions
Aggregate functionsAggregate functions
Aggregate functions
sinhacp
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
Sachidananda M H
 
Working with Databases and MySQL
Working with Databases and MySQLWorking with Databases and MySQL
Working with Databases and MySQL
Nicole Ryan
 
Introduction to sql
Introduction to sqlIntroduction to sql
Introduction to sql
VARSHAKUMARI49
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
Shrija Madhu
 
SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries Information
Nishant Munjal
 
MYSQL Aggregate Functions
MYSQL Aggregate FunctionsMYSQL Aggregate Functions
MYSQL Aggregate Functions
Leroy Blair
 
SQL select statement and functions
SQL select statement and functionsSQL select statement and functions
SQL select statement and functions
Vikas Gupta
 
Introduction to-sql
Introduction to-sqlIntroduction to-sql
Introduction to-sql
BG Java EE Course
 
Structured Query Language (SQL)
Structured Query Language (SQL)Structured Query Language (SQL)
Structured Query Language (SQL)
Syed Hassan Ali
 
SQL JOIN
SQL JOINSQL JOIN
SQL JOIN
Ritwik Das
 
Complex queries in sql
Complex queries in sqlComplex queries in sql
Complex queries in sql
Charan Reddy
 
Les01 (retrieving data using the sql select statement)
Les01 (retrieving data using the sql select statement)Les01 (retrieving data using the sql select statement)
Les01 (retrieving data using the sql select statement)
Achmad Solichin
 
Sql and Sql commands
Sql and Sql commandsSql and Sql commands
Sql and Sql commands
Knowledge Center Computer
 
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Beat Signer
 
Les08 (manipulating data)
Les08 (manipulating data)Les08 (manipulating data)
Les08 (manipulating data)
Achmad Solichin
 
Sql commands
Sql commandsSql commands
Sql commands
Balakumaran Arunachalam
 
Joins And Its Types
Joins And Its TypesJoins And Its Types
Joins And Its Types
Wings Interactive
 
SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)
Sharad Dubey
 
Group By, Order By, and Aliases in SQL
Group By, Order By, and Aliases in SQLGroup By, Order By, and Aliases in SQL
Group By, Order By, and Aliases in SQL
MSB Academy
 
Aggregate functions
Aggregate functionsAggregate functions
Aggregate functions
sinhacp
 
Working with Databases and MySQL
Working with Databases and MySQLWorking with Databases and MySQL
Working with Databases and MySQL
Nicole Ryan
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
Shrija Madhu
 
SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries Information
Nishant Munjal
 
MYSQL Aggregate Functions
MYSQL Aggregate FunctionsMYSQL Aggregate Functions
MYSQL Aggregate Functions
Leroy Blair
 
SQL select statement and functions
SQL select statement and functionsSQL select statement and functions
SQL select statement and functions
Vikas Gupta
 
Structured Query Language (SQL)
Structured Query Language (SQL)Structured Query Language (SQL)
Structured Query Language (SQL)
Syed Hassan Ali
 
Complex queries in sql
Complex queries in sqlComplex queries in sql
Complex queries in sql
Charan Reddy
 
Les01 (retrieving data using the sql select statement)
Les01 (retrieving data using the sql select statement)Les01 (retrieving data using the sql select statement)
Les01 (retrieving data using the sql select statement)
Achmad Solichin
 
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Beat Signer
 
Les08 (manipulating data)
Les08 (manipulating data)Les08 (manipulating data)
Les08 (manipulating data)
Achmad Solichin
 

Viewers also liked (20)

Sql
SqlSql
Sql
ftz 420
 
Wordpress developers new york
Wordpress developers new yorkWordpress developers new york
Wordpress developers new york
Bhupendra Rajput
 
UML perusteet
UML perusteetUML perusteet
UML perusteet
Pasi Kellokoski
 
T-121.5300 Käyttoliittymasuunnittelu - Mallit
T-121.5300 Käyttoliittymasuunnittelu - MallitT-121.5300 Käyttoliittymasuunnittelu - Mallit
T-121.5300 Käyttoliittymasuunnittelu - Mallit
mniemi
 
Innovative ICT Based Library Services
Innovative ICT Based Library ServicesInnovative ICT Based Library Services
Innovative ICT Based Library Services
Glob@l Libraries - Bulgaria Program
 
Web based database application design using vb.net and sql server
Web based database application design using vb.net and sql serverWeb based database application design using vb.net and sql server
Web based database application design using vb.net and sql server
Ammara Arooj
 
[Www.pkbulk.blogspot.com]dbms11
[Www.pkbulk.blogspot.com]dbms11[Www.pkbulk.blogspot.com]dbms11
[Www.pkbulk.blogspot.com]dbms11
AnusAhmad
 
Sql insert statement
Sql insert statementSql insert statement
Sql insert statement
Vivek Singh
 
6. triggers
6. triggers6. triggers
6. triggers
Amrit Kaur
 
Sql create table statement
Sql create table statementSql create table statement
Sql create table statement
Vivek Singh
 
SAP HANA - Manually to insert_data_table
SAP HANA - Manually to insert_data_tableSAP HANA - Manually to insert_data_table
SAP HANA - Manually to insert_data_table
Yasmin Ashraf
 
Sql wksht-7
Sql wksht-7Sql wksht-7
Sql wksht-7
Mukesh Tekwani
 
Part 15 triggerr
Part 15  triggerrPart 15  triggerr
Part 15 triggerr
Denny Yahya
 
Sql update statement
Sql update statementSql update statement
Sql update statement
Vivek Singh
 
Sql delete, truncate, drop statements
Sql delete, truncate, drop statementsSql delete, truncate, drop statements
Sql delete, truncate, drop statements
Vivek Singh
 
Database presentation
Database presentationDatabase presentation
Database presentation
webhostingguy
 
PL/SQL Code for Sample Projects
PL/SQL Code for Sample ProjectsPL/SQL Code for Sample Projects
PL/SQL Code for Sample Projects
jwjablonski
 
Oracle Database Trigger
Oracle Database TriggerOracle Database Trigger
Oracle Database Trigger
Eryk Budi Pratama
 
SQL Tutorial - How To Create, Drop, and Truncate Table
SQL Tutorial - How To Create, Drop, and Truncate TableSQL Tutorial - How To Create, Drop, and Truncate Table
SQL Tutorial - How To Create, Drop, and Truncate Table
1keydata
 
T-SQL Overview
T-SQL OverviewT-SQL Overview
T-SQL Overview
Ahmed Elbaz
 
Wordpress developers new york
Wordpress developers new yorkWordpress developers new york
Wordpress developers new york
Bhupendra Rajput
 
T-121.5300 Käyttoliittymasuunnittelu - Mallit
T-121.5300 Käyttoliittymasuunnittelu - MallitT-121.5300 Käyttoliittymasuunnittelu - Mallit
T-121.5300 Käyttoliittymasuunnittelu - Mallit
mniemi
 
Web based database application design using vb.net and sql server
Web based database application design using vb.net and sql serverWeb based database application design using vb.net and sql server
Web based database application design using vb.net and sql server
Ammara Arooj
 
[Www.pkbulk.blogspot.com]dbms11
[Www.pkbulk.blogspot.com]dbms11[Www.pkbulk.blogspot.com]dbms11
[Www.pkbulk.blogspot.com]dbms11
AnusAhmad
 
Sql insert statement
Sql insert statementSql insert statement
Sql insert statement
Vivek Singh
 
Sql create table statement
Sql create table statementSql create table statement
Sql create table statement
Vivek Singh
 
SAP HANA - Manually to insert_data_table
SAP HANA - Manually to insert_data_tableSAP HANA - Manually to insert_data_table
SAP HANA - Manually to insert_data_table
Yasmin Ashraf
 
Part 15 triggerr
Part 15  triggerrPart 15  triggerr
Part 15 triggerr
Denny Yahya
 
Sql update statement
Sql update statementSql update statement
Sql update statement
Vivek Singh
 
Sql delete, truncate, drop statements
Sql delete, truncate, drop statementsSql delete, truncate, drop statements
Sql delete, truncate, drop statements
Vivek Singh
 
Database presentation
Database presentationDatabase presentation
Database presentation
webhostingguy
 
PL/SQL Code for Sample Projects
PL/SQL Code for Sample ProjectsPL/SQL Code for Sample Projects
PL/SQL Code for Sample Projects
jwjablonski
 
SQL Tutorial - How To Create, Drop, and Truncate Table
SQL Tutorial - How To Create, Drop, and Truncate TableSQL Tutorial - How To Create, Drop, and Truncate Table
SQL Tutorial - How To Create, Drop, and Truncate Table
1keydata
 
Ad

Similar to Sql – Structured Query Language (20)

SQL
SQLSQL
SQL
Shyam Khant
 
Advanced Database Systems - Presentation 3.pptx
Advanced Database Systems - Presentation 3.pptxAdvanced Database Systems - Presentation 3.pptx
Advanced Database Systems - Presentation 3.pptx
EllenGracePorras
 
SQL. It education ppt for reference sql process coding
SQL. It education ppt for reference  sql process codingSQL. It education ppt for reference  sql process coding
SQL. It education ppt for reference sql process coding
aditipandey498628
 
Sql
SqlSql
Sql
Archana Rout
 
SQL Tutorial for BCA-2
SQL Tutorial for BCA-2SQL Tutorial for BCA-2
SQL Tutorial for BCA-2
Raj vardhan
 
ORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDS
ORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDSORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDS
ORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDS
Newyorksys.com
 
CE 279 - WRITING SQL QUERIES umat edition.ppt
CE 279 - WRITING SQL QUERIES umat edition.pptCE 279 - WRITING SQL QUERIES umat edition.ppt
CE 279 - WRITING SQL QUERIES umat edition.ppt
minusahsaaka
 
Sql
SqlSql
Sql
jyothislides
 
Sql slid
Sql slidSql slid
Sql slid
pacatarpit
 
MS SQL Server 1
MS SQL Server 1MS SQL Server 1
MS SQL Server 1
Iblesoft
 
Introduction to sql
Introduction to sqlIntroduction to sql
Introduction to sql
SARVESH KUMAR
 
Structured Query Language (SQL).pptx
Structured Query Language (SQL).pptxStructured Query Language (SQL).pptx
Structured Query Language (SQL).pptx
EllenGracePorras
 
06.01 sql select distinct
06.01 sql select distinct06.01 sql select distinct
06.01 sql select distinct
Bishal Ghimire
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
amitabros
 
Sql commands
Sql commandsSql commands
Sql commands
Pooja Dixit
 
Module 3
Module 3Module 3
Module 3
cs19club
 
SQL notes 1.pdf
SQL notes 1.pdfSQL notes 1.pdf
SQL notes 1.pdf
JitendraYadav351971
 
SQL
SQLSQL
SQL
Jerin John
 
SQL
SQLSQL
SQL
Jerin John
 
Sql overview-1232931296681161-1
Sql overview-1232931296681161-1Sql overview-1232931296681161-1
Sql overview-1232931296681161-1
sagaroceanic11
 
Advanced Database Systems - Presentation 3.pptx
Advanced Database Systems - Presentation 3.pptxAdvanced Database Systems - Presentation 3.pptx
Advanced Database Systems - Presentation 3.pptx
EllenGracePorras
 
SQL. It education ppt for reference sql process coding
SQL. It education ppt for reference  sql process codingSQL. It education ppt for reference  sql process coding
SQL. It education ppt for reference sql process coding
aditipandey498628
 
SQL Tutorial for BCA-2
SQL Tutorial for BCA-2SQL Tutorial for BCA-2
SQL Tutorial for BCA-2
Raj vardhan
 
ORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDS
ORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDSORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDS
ORACLE PL/SQL TUTORIALS - OVERVIEW - SQL COMMANDS
Newyorksys.com
 
CE 279 - WRITING SQL QUERIES umat edition.ppt
CE 279 - WRITING SQL QUERIES umat edition.pptCE 279 - WRITING SQL QUERIES umat edition.ppt
CE 279 - WRITING SQL QUERIES umat edition.ppt
minusahsaaka
 
MS SQL Server 1
MS SQL Server 1MS SQL Server 1
MS SQL Server 1
Iblesoft
 
Structured Query Language (SQL).pptx
Structured Query Language (SQL).pptxStructured Query Language (SQL).pptx
Structured Query Language (SQL).pptx
EllenGracePorras
 
06.01 sql select distinct
06.01 sql select distinct06.01 sql select distinct
06.01 sql select distinct
Bishal Ghimire
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
amitabros
 
Sql overview-1232931296681161-1
Sql overview-1232931296681161-1Sql overview-1232931296681161-1
Sql overview-1232931296681161-1
sagaroceanic11
 
Ad

Recently uploaded (20)

Cultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptxCultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptx
UmeshTimilsina1
 
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon DolabaniHistory Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
fruinkamel7m
 
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Association for Project Management
 
How to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 PurchaseHow to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 Purchase
Celine George
 
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living WorkshopLDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDM Mia eStudios
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFAMEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
Dr. Nasir Mustafa
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
Cultivation Practice of Turmeric in Nepal.pptx
Cultivation Practice of Turmeric in Nepal.pptxCultivation Practice of Turmeric in Nepal.pptx
Cultivation Practice of Turmeric in Nepal.pptx
UmeshTimilsina1
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18
Celine George
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)
jemille6
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
2025 The Senior Landscape and SET plan preparations.pptx
2025 The Senior Landscape and SET plan preparations.pptx2025 The Senior Landscape and SET plan preparations.pptx
2025 The Senior Landscape and SET plan preparations.pptx
mansk2
 
Cultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptxCultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptx
UmeshTimilsina1
 
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon DolabaniHistory Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
fruinkamel7m
 
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Association for Project Management
 
How to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 PurchaseHow to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 Purchase
Celine George
 
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living WorkshopLDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDM Mia eStudios
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFAMEDICAL BIOLOGY MCQS  BY. DR NASIR MUSTAFA
MEDICAL BIOLOGY MCQS BY. DR NASIR MUSTAFA
Dr. Nasir Mustafa
 
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
How to Clean Your Contacts Using the Deduplication Menu in Odoo 18
Celine George
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
Cultivation Practice of Turmeric in Nepal.pptx
Cultivation Practice of Turmeric in Nepal.pptxCultivation Practice of Turmeric in Nepal.pptx
Cultivation Practice of Turmeric in Nepal.pptx
UmeshTimilsina1
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18How to Share Accounts Between Companies in Odoo 18
How to Share Accounts Between Companies in Odoo 18
Celine George
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
Origin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theoriesOrigin of Brahmi script: A breaking down of various theories
Origin of Brahmi script: A breaking down of various theories
PrachiSontakke5
 
What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)What is the Philosophy of Statistics? (and how I was drawn to it)
What is the Philosophy of Statistics? (and how I was drawn to it)
jemille6
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
2025 The Senior Landscape and SET plan preparations.pptx
2025 The Senior Landscape and SET plan preparations.pptx2025 The Senior Landscape and SET plan preparations.pptx
2025 The Senior Landscape and SET plan preparations.pptx
mansk2
 

Sql – Structured Query Language

  • 1. SQL – Structured Query Language By: - Vikash Pandey Roll No: - 43 Bhavan’s Institute of Mgmt. Science 2008-2010
  • 2. What is SQL? SQL stands for Structured Query Language. SQL lets you access and manipulate databases. SQL is an ANSI (American National Standards Institute) standard.
  • 3. What Can SQL do? SQL can execute queries against a database. SQL can retrieve data from a database. SQL can insert records in a database. SQL can update records in a database. SQL can delete records from a database. SQL can create new databases. SQL can create new tables in a database. SQL can create stored procedures in a database. SQL can create views in a database. SQL can set permissions on tables, procedures, and views.
  • 4. SQL is a Standard - BUT.... Although SQL is an ANSI (American National Standards Institute) standard, there are many different versions of the SQL language. However, to be compliant with the ANSI standard, they all support at least the major commands (such as SELECT, UPDATE, DELETE, INSERT, WHERE) in a similar manner.
  • 5. SQL DML & DDL SQL can be divided into two parts: The Data Manipulation Language (DML) and the Data Definition Language (DDL). The query and update commands form the DML part of SQL: 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
  • 6. The DDL part of SQL permits database tables to be created or deleted. It also define indexes (keys), specify links between tables, and impose constraints between tables. The most important DDL statements in SQL are: CREATE DATABASE - creates a new database ALTER DATABASE - modifies a database CREATE TABLE - creates a new table ALTER TABLE - modifies a table DROP TABLE - deletes a table CREATE INDEX - creates an index (search key) DROP INDEX - deletes an index
  • 7. The SQL SELECT Statement The SELECT statement is used to select data from a database. The result is stored in a result table, called the result-set. SQL SELECT Syntax SELECT column_name(s) FROM table_name and SELECT * FROM table_name Note: SQL is not case sensitive. SELECT is the same as select
  • 8. Example: - Now we want to select the content of the columns named "LastName" and "FirstName" from the table above. We use the following SELECT statement: SELECT LastName,FirstName FROM Persons The result-set will look like this: P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai
  • 9. Last Name First Name Das Sirsendu Ray Roshni Banerjee Saurav
  • 10. SELECT * Example Now we want to select all the columns from the "Persons" table. We use the following SELECT statement:  SELECT * FROM Persons Tip: The asterisk (*) is a quick way of selecting all columns! The result-set will look like this: P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai
  • 11. SQL UPDATE Statement The UPDATE statement is used to update existing records in a table. SQL UPDATE Syntax UPDATE table_name SET column1=value, column2=value2,... WHERE some_column=some_value Note: Notice the WHERE clause in the UPDATE syntax. The WHERE clause specifies which record or records that should be updated. If you omit the WHERE clause, all records will be updated!
  • 12. Example: - We use the following SQL statement: Now we want to update the person “Sinha, Joyeeti" in the "Persons" table. UPDATE Persons SET Address=‘Ernakulam', City=‘Chennai’ WHERE LastName=‘Sinha' AND FirstName='Joyeeti' P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai 4 Sinha Joyeeti
  • 13. The "Persons" table will now look like this: P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai 4 Sinha Joyeeti Ernakulam Chennai
  • 14. SQL DELETE Statement The DELETE statement is used to delete rows in a table. SQL DELETE Syntax DELETE FROM table_name WHERE some_column=some_value Note: Notice the WHERE clause in the DELETE syntax. The WHERE clause specifies which record or records that should be deleted. If you omit the WHERE clause, all records will be deleted!
  • 15. Example: - We use the following SQL statement: Now we want to delete the person “Sinha, Joyeeti" in the "Persons" table. DELETE FROM Persons WHERE LastName=‘Sinha' AND FirstName='Joyeeti' P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai 4 Sinha Joyeeti Ernakulam Chennai
  • 16. It is possible to delete all rows in a table without deleting the table. This means that the table structure, attributes, and indexes will be intact: DELETE FROM table_name or DELETE * FROM table_name P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai
  • 17. SQL INSERT INTO Statement The INSERT INTO statement is used to insert a new row in a table. SQL INSERT INTO Syntax It is possible to write the INSERT INTO statement in two forms. The first form doesn't specify the column names where the data will be inserted, only their values: INSERT INTO table_name VALUES (value1, value2, value3,...) The second form specifies both the column names and the values to be inserted: INSERT INTO table_name (column1, column2, column3,...) VALUES (value1, value2, value3,...)
  • 18. Example We have the following “Persons” table: - Now we want to insert a new row in the "Persons" table. We use the following SQL statement: INSERT INTO Persons VALUES (4,‘Sinha', 'Joyeeti', ‘Ernakulam', ‘Chennai') P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai
  • 19. The table would look like: - P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai 4 Sinha Joyeeti Ernakulam Chennai
  • 20. INSERT Data Only In Specified Columns It is also possible to only add data in specific columns. The following SQL statement will add a new row, but only add data in the "P_Id", "LastName" and the "FirstName" columns: INSERT INTO Persons (P_Id, LastName, FirstName) VALUES (5, ‘Das', ‘Kaustav') P-Id Last Name First Name Address City 1 Das Sirsendu Barrackpur Kolkata 2 Ray Roshni Dwarka Delhi 3 Banerjee Saurav Andheri Mumbai 4 Sinha Joyeeti Ernakulam Chennai 5 Das Kaustav

Editor's Notes

  • #5: Note: Most of the SQL database programs also have their own proprietary extensions in addition to the SQL standard!
  翻译: