SlideShare a Scribd company logo
1 of 13
Advanced Database
Systems
INSTRUCTOR:
ELLEN GRACE
PORRAS
FIRST SEMESTER 2022-2023
OVERVIEW
Welcome to the first module of this course on the Advanced Database Systems!
Understanding of SQL and its capabilities for querying a single table a prerequisite.
In this subject, you will learn how to retrieve data from multiple tables using one
SQL statement. You will see how tables can be joined together and how similar
results are obtained using different approaches, including the joints and sub queries.
It is important that you understand how to query multiple tables for generating
appropriate reports in the creation of an information system.
Advanced Database Systems
SQL
Statements
9/3/20XX Presentation Title 3
Advanced Database Systems
4
Advanced Database Systems
SQL WHERE Clause
The WHERE clause is used to filter records. It is used to extract only
those records that fulfill a specified criterion.
SQL WHERE Syntax:
SELECT column_name(s)
FROM table_name
WHERE column_name operator value
5
Advanced Database Systems
Example: WHERE Clause
Table Name: Persons
P_Id LastName FirstName Address City
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger
Now we want to select only the persons living in the city "Sandnes" from the table above.
We use the following SELECT statement:
SELECT * FROM Persons
WHERE City='Sandnes'
Or
SELECT *
FROM Persons
WHERE City='Sandnes'
6
Advanced Database Systems
The result-set will look like this:
P_Id LastName FirstName Address City
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
7
Advanced Database Systems
Quotes around Text Fields
SQL uses single quotes around text values (most database systems will also accept
double quotes). However, numeric values should not be enclosed in quotes.
For text values:
• This is correct
SELECT *
FROM Persons
WHERE FirstName='Tove'
8
Advanced Database Systems
• This is wrong:
SELECT *
FROM Persons
WHERE FirstName=Tove
For numeric values:
• This is correct:
SELECT *
FROM Persons
WHERE Year=1965
• This is wrong:
SELECT *
FROM Persons
WHERE Year='1965'
9
Advanced Database Systems
Operators Allowed in the WHERE Clause
With the WHERE clause, the following operators can be used:
Operator Description
= Equal
<> Not equal
> Greater than
< Less than
>= Greater than or equal
<= Less than or equal
BETWEEN Between an inclusive range
LIKE Search for a pattern
IN To specify multiple possible values for a column
Note: In some versions of SQL the <> operator may be written as !=
10
Advanced Database Systems
SQL DELETE Statement
The DELETE statement is used to delete records 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!
11
Advanced Database Systems
Now we want to delete the person "Tjessem, Jakob" in the "Persons" table.
We use the following SQL statement:
DELETE FROM Persons
WHERE LastName='Tjessem' AND FirstName='Jakob’
The "Persons" table will now look like this:
P_Id LastName FirstName Address City
1 Hansen Ola Timoteivn 10 Sandnes
2 Svendson Tove Borgvn 23 Sandnes
3 Pettersen Kari Storgt 20 Stavanger
4 Nilsen Johan Bakken 2 Stavanger
12
Advanced Database Systems
Delete All Rows
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
Note: Be very careful when deleting records. You cannot undo this statement!
Thank you
Presenter name: Ellen Grace D. Porras
Email address: egporras@psu.palawan.edu.ph
This Photo by Unknown Author is licensed under CC BY-SA-NC

More Related Content

Similar to Advanced Database Systems - Presentation 3.pptx

Similar to Advanced Database Systems - Presentation 3.pptx (20)

A must Sql notes for beginners
A must Sql notes for beginnersA must Sql notes for beginners
A must Sql notes for beginners
 
Sql – Structured Query Language
Sql – Structured Query LanguageSql – Structured Query Language
Sql – Structured Query Language
 
Sql slid
Sql slidSql slid
Sql slid
 
SQL
SQLSQL
SQL
 
Lab
LabLab
Lab
 
Sql basic things
Sql basic thingsSql basic things
Sql basic things
 
Sql
SqlSql
Sql
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
Relational Database Language.pptx
Relational Database Language.pptxRelational Database Language.pptx
Relational Database Language.pptx
 
SQL
SQLSQL
SQL
 
Hira
HiraHira
Hira
 
98765432345671223Intro-to-PostgreSQL.ppt
98765432345671223Intro-to-PostgreSQL.ppt98765432345671223Intro-to-PostgreSQL.ppt
98765432345671223Intro-to-PostgreSQL.ppt
 
Assg2 b 19121033-converted
Assg2 b 19121033-convertedAssg2 b 19121033-converted
Assg2 b 19121033-converted
 
DBMS LAB M.docx
DBMS LAB M.docxDBMS LAB M.docx
DBMS LAB M.docx
 
SQL | DML
SQL | DMLSQL | DML
SQL | DML
 
Module 3
Module 3Module 3
Module 3
 
Structured Query Language (SQL) Part 2.pptx
Structured Query Language (SQL) Part 2.pptxStructured Query Language (SQL) Part 2.pptx
Structured Query Language (SQL) Part 2.pptx
 
SQL_BASIC AND ADVANCED.pdf
SQL_BASIC AND ADVANCED.pdfSQL_BASIC AND ADVANCED.pdf
SQL_BASIC AND ADVANCED.pdf
 
MySQL Essential Training
MySQL Essential TrainingMySQL Essential Training
MySQL Essential Training
 
SQL Tutorial for BCA-2
SQL Tutorial for BCA-2SQL Tutorial for BCA-2
SQL Tutorial for BCA-2
 

More from EllenGracePorras

Lesson 3 Introduction to Human Computer Interaction.pptx
Lesson 3 Introduction to Human Computer Interaction.pptxLesson 3 Introduction to Human Computer Interaction.pptx
Lesson 3 Introduction to Human Computer Interaction.pptxEllenGracePorras
 
Lesson 4 Introduction to Human Computer Interaction.pptx
Lesson 4 Introduction to Human Computer Interaction.pptxLesson 4 Introduction to Human Computer Interaction.pptx
Lesson 4 Introduction to Human Computer Interaction.pptxEllenGracePorras
 
Geographic Information System(GIS).pptx
Geographic  Information System(GIS).pptxGeographic  Information System(GIS).pptx
Geographic Information System(GIS).pptxEllenGracePorras
 
Geographic Information Systems (GIS).pptx
Geographic  Information Systems (GIS).pptxGeographic  Information Systems (GIS).pptx
Geographic Information Systems (GIS).pptxEllenGracePorras
 
Advanced Database Systems.pptx
Advanced Database Systems.pptxAdvanced Database Systems.pptx
Advanced Database Systems.pptxEllenGracePorras
 
Data Manipulation Language.pptx
Data Manipulation Language.pptxData Manipulation Language.pptx
Data Manipulation Language.pptxEllenGracePorras
 
Advanced Database Systems - Presentation 4.pptx
Advanced Database Systems - Presentation 4.pptxAdvanced Database Systems - Presentation 4.pptx
Advanced Database Systems - Presentation 4.pptxEllenGracePorras
 
Advanced Database Systems - Presentation 1 with quiz.pptx
Advanced Database Systems - Presentation 1 with quiz.pptxAdvanced Database Systems - Presentation 1 with quiz.pptx
Advanced Database Systems - Presentation 1 with quiz.pptxEllenGracePorras
 
.Net Technologies Lesson 1.pptx
.Net Technologies Lesson 1.pptx.Net Technologies Lesson 1.pptx
.Net Technologies Lesson 1.pptxEllenGracePorras
 

More from EllenGracePorras (15)

Lesson 3 Introduction to Human Computer Interaction.pptx
Lesson 3 Introduction to Human Computer Interaction.pptxLesson 3 Introduction to Human Computer Interaction.pptx
Lesson 3 Introduction to Human Computer Interaction.pptx
 
Lesson 4 Introduction to Human Computer Interaction.pptx
Lesson 4 Introduction to Human Computer Interaction.pptxLesson 4 Introduction to Human Computer Interaction.pptx
Lesson 4 Introduction to Human Computer Interaction.pptx
 
Geographic Information System(GIS).pptx
Geographic  Information System(GIS).pptxGeographic  Information System(GIS).pptx
Geographic Information System(GIS).pptx
 
Geographic Information Systems (GIS).pptx
Geographic  Information Systems (GIS).pptxGeographic  Information Systems (GIS).pptx
Geographic Information Systems (GIS).pptx
 
Advanced Database Systems.pptx
Advanced Database Systems.pptxAdvanced Database Systems.pptx
Advanced Database Systems.pptx
 
Data Manipulation Language.pptx
Data Manipulation Language.pptxData Manipulation Language.pptx
Data Manipulation Language.pptx
 
Advanced Database Systems - Presentation 4.pptx
Advanced Database Systems - Presentation 4.pptxAdvanced Database Systems - Presentation 4.pptx
Advanced Database Systems - Presentation 4.pptx
 
Advanced Database Systems - Presentation 1 with quiz.pptx
Advanced Database Systems - Presentation 1 with quiz.pptxAdvanced Database Systems - Presentation 1 with quiz.pptx
Advanced Database Systems - Presentation 1 with quiz.pptx
 
SQL Where Clause.pptx
SQL Where Clause.pptxSQL Where Clause.pptx
SQL Where Clause.pptx
 
SQL Statements.pptx
SQL Statements.pptxSQL Statements.pptx
SQL Statements.pptx
 
Information Management
Information ManagementInformation Management
Information Management
 
Lesson 2 HCI 2.pptx
Lesson 2 HCI 2.pptxLesson 2 HCI 2.pptx
Lesson 2 HCI 2.pptx
 
Lesson 2 HCI 2.pdf
Lesson 2 HCI 2.pdfLesson 2 HCI 2.pdf
Lesson 2 HCI 2.pdf
 
.Net Technologies Lesson 1.pptx
.Net Technologies Lesson 1.pptx.Net Technologies Lesson 1.pptx
.Net Technologies Lesson 1.pptx
 
CC 1/L Introduction.pptx
CC 1/L Introduction.pptxCC 1/L Introduction.pptx
CC 1/L Introduction.pptx
 

Recently uploaded

Mysore Call Girls 7001305949 WhatsApp Number 24x7 Best Services
Mysore Call Girls 7001305949 WhatsApp Number 24x7 Best ServicesMysore Call Girls 7001305949 WhatsApp Number 24x7 Best Services
Mysore Call Girls 7001305949 WhatsApp Number 24x7 Best Servicesnajka9823
 
France's UEFA Euro 2024 Ambitions Amid Coman's Injury.docx
France's UEFA Euro 2024 Ambitions Amid Coman's Injury.docxFrance's UEFA Euro 2024 Ambitions Amid Coman's Injury.docx
France's UEFA Euro 2024 Ambitions Amid Coman's Injury.docxEuro Cup 2024 Tickets
 
大学假文凭《原版英国Imperial文凭》帝国理工学院毕业证制作成绩单修改
大学假文凭《原版英国Imperial文凭》帝国理工学院毕业证制作成绩单修改大学假文凭《原版英国Imperial文凭》帝国理工学院毕业证制作成绩单修改
大学假文凭《原版英国Imperial文凭》帝国理工学院毕业证制作成绩单修改atducpo
 
办理学位证(KCL文凭证书)伦敦国王学院毕业证成绩单原版一模一样
办理学位证(KCL文凭证书)伦敦国王学院毕业证成绩单原版一模一样办理学位证(KCL文凭证书)伦敦国王学院毕业证成绩单原版一模一样
办理学位证(KCL文凭证书)伦敦国王学院毕业证成绩单原版一模一样7pn7zv3i
 
Croatia vs Italy UEFA Euro 2024 Croatia's Checkered Legacy on Display in New ...
Croatia vs Italy UEFA Euro 2024 Croatia's Checkered Legacy on Display in New ...Croatia vs Italy UEFA Euro 2024 Croatia's Checkered Legacy on Display in New ...
Croatia vs Italy UEFA Euro 2024 Croatia's Checkered Legacy on Display in New ...Eticketing.co
 
Tableaux 9ème étape circuit fédéral 2024
Tableaux 9ème étape circuit fédéral 2024Tableaux 9ème étape circuit fédéral 2024
Tableaux 9ème étape circuit fédéral 2024HechemLaameri
 
Call Girls in Dhaula Kuan 💯Call Us 🔝8264348440🔝
Call Girls in Dhaula Kuan 💯Call Us 🔝8264348440🔝Call Girls in Dhaula Kuan 💯Call Us 🔝8264348440🔝
Call Girls in Dhaula Kuan 💯Call Us 🔝8264348440🔝soniya singh
 
Technical Data | ThermTec Wild 650L | Optics Trade
Technical Data | ThermTec Wild 650L | Optics TradeTechnical Data | ThermTec Wild 650L | Optics Trade
Technical Data | ThermTec Wild 650L | Optics TradeOptics-Trade
 
Real Moto 2 MOD APK v1.1.721 All Bikes, Unlimited Money
Real Moto 2 MOD APK v1.1.721 All Bikes, Unlimited MoneyReal Moto 2 MOD APK v1.1.721 All Bikes, Unlimited Money
Real Moto 2 MOD APK v1.1.721 All Bikes, Unlimited MoneyApk Toly
 
8377087607 ☎, Cash On Delivery Call Girls Service In Hauz Khas Delhi Enjoy 24/7
8377087607 ☎, Cash On Delivery Call Girls Service In Hauz Khas Delhi Enjoy 24/78377087607 ☎, Cash On Delivery Call Girls Service In Hauz Khas Delhi Enjoy 24/7
8377087607 ☎, Cash On Delivery Call Girls Service In Hauz Khas Delhi Enjoy 24/7dollysharma2066
 
Atlanta Dream Exec Dan Gadd on Driving Fan Engagement and Growth, Serving the...
Atlanta Dream Exec Dan Gadd on Driving Fan Engagement and Growth, Serving the...Atlanta Dream Exec Dan Gadd on Driving Fan Engagement and Growth, Serving the...
Atlanta Dream Exec Dan Gadd on Driving Fan Engagement and Growth, Serving the...Neil Horowitz
 
Dubai Call Girls Bikni O528786472 Call Girls Dubai Ebony
Dubai Call Girls Bikni O528786472 Call Girls Dubai EbonyDubai Call Girls Bikni O528786472 Call Girls Dubai Ebony
Dubai Call Girls Bikni O528786472 Call Girls Dubai Ebonyhf8803863
 
Resultados del Campeonato mundial de Marcha por equipos Antalya 2024
Resultados del Campeonato mundial de Marcha por equipos Antalya 2024Resultados del Campeonato mundial de Marcha por equipos Antalya 2024
Resultados del Campeonato mundial de Marcha por equipos Antalya 2024Judith Chuquipul
 
Presentation: The symbols of the Olympic Games
Presentation: The symbols of the Olympic  GamesPresentation: The symbols of the Olympic  Games
Presentation: The symbols of the Olympic Gamesluciavilafernandez
 
Plan d'orientations stratégiques rugby féminin
Plan d'orientations stratégiques rugby fémininPlan d'orientations stratégiques rugby féminin
Plan d'orientations stratégiques rugby fémininThibaut TATRY
 
JORNADA 4 LIGA MURO 2024TUXTEPEC1234.pdf
JORNADA 4 LIGA MURO 2024TUXTEPEC1234.pdfJORNADA 4 LIGA MURO 2024TUXTEPEC1234.pdf
JORNADA 4 LIGA MURO 2024TUXTEPEC1234.pdfArturo Pacheco Alvarez
 
ppt on Myself, Occupation and my Interest
ppt on Myself, Occupation and my Interestppt on Myself, Occupation and my Interest
ppt on Myself, Occupation and my InterestNagaissenValaydum
 

Recently uploaded (20)

young Call girls in Moolchand 🔝 9953056974 🔝 Delhi escort Service
young Call girls in Moolchand 🔝 9953056974 🔝 Delhi escort Serviceyoung Call girls in Moolchand 🔝 9953056974 🔝 Delhi escort Service
young Call girls in Moolchand 🔝 9953056974 🔝 Delhi escort Service
 
Mysore Call Girls 7001305949 WhatsApp Number 24x7 Best Services
Mysore Call Girls 7001305949 WhatsApp Number 24x7 Best ServicesMysore Call Girls 7001305949 WhatsApp Number 24x7 Best Services
Mysore Call Girls 7001305949 WhatsApp Number 24x7 Best Services
 
France's UEFA Euro 2024 Ambitions Amid Coman's Injury.docx
France's UEFA Euro 2024 Ambitions Amid Coman's Injury.docxFrance's UEFA Euro 2024 Ambitions Amid Coman's Injury.docx
France's UEFA Euro 2024 Ambitions Amid Coman's Injury.docx
 
大学假文凭《原版英国Imperial文凭》帝国理工学院毕业证制作成绩单修改
大学假文凭《原版英国Imperial文凭》帝国理工学院毕业证制作成绩单修改大学假文凭《原版英国Imperial文凭》帝国理工学院毕业证制作成绩单修改
大学假文凭《原版英国Imperial文凭》帝国理工学院毕业证制作成绩单修改
 
办理学位证(KCL文凭证书)伦敦国王学院毕业证成绩单原版一模一样
办理学位证(KCL文凭证书)伦敦国王学院毕业证成绩单原版一模一样办理学位证(KCL文凭证书)伦敦国王学院毕业证成绩单原版一模一样
办理学位证(KCL文凭证书)伦敦国王学院毕业证成绩单原版一模一样
 
Croatia vs Italy UEFA Euro 2024 Croatia's Checkered Legacy on Display in New ...
Croatia vs Italy UEFA Euro 2024 Croatia's Checkered Legacy on Display in New ...Croatia vs Italy UEFA Euro 2024 Croatia's Checkered Legacy on Display in New ...
Croatia vs Italy UEFA Euro 2024 Croatia's Checkered Legacy on Display in New ...
 
Tableaux 9ème étape circuit fédéral 2024
Tableaux 9ème étape circuit fédéral 2024Tableaux 9ème étape circuit fédéral 2024
Tableaux 9ème étape circuit fédéral 2024
 
Call Girls in Dhaula Kuan 💯Call Us 🔝8264348440🔝
Call Girls in Dhaula Kuan 💯Call Us 🔝8264348440🔝Call Girls in Dhaula Kuan 💯Call Us 🔝8264348440🔝
Call Girls in Dhaula Kuan 💯Call Us 🔝8264348440🔝
 
Technical Data | ThermTec Wild 650L | Optics Trade
Technical Data | ThermTec Wild 650L | Optics TradeTechnical Data | ThermTec Wild 650L | Optics Trade
Technical Data | ThermTec Wild 650L | Optics Trade
 
Real Moto 2 MOD APK v1.1.721 All Bikes, Unlimited Money
Real Moto 2 MOD APK v1.1.721 All Bikes, Unlimited MoneyReal Moto 2 MOD APK v1.1.721 All Bikes, Unlimited Money
Real Moto 2 MOD APK v1.1.721 All Bikes, Unlimited Money
 
FULL ENJOY Call Girls In Savitri Nagar (Delhi) Call Us 9953056974
FULL ENJOY Call Girls In  Savitri Nagar (Delhi) Call Us 9953056974FULL ENJOY Call Girls In  Savitri Nagar (Delhi) Call Us 9953056974
FULL ENJOY Call Girls In Savitri Nagar (Delhi) Call Us 9953056974
 
8377087607 ☎, Cash On Delivery Call Girls Service In Hauz Khas Delhi Enjoy 24/7
8377087607 ☎, Cash On Delivery Call Girls Service In Hauz Khas Delhi Enjoy 24/78377087607 ☎, Cash On Delivery Call Girls Service In Hauz Khas Delhi Enjoy 24/7
8377087607 ☎, Cash On Delivery Call Girls Service In Hauz Khas Delhi Enjoy 24/7
 
Atlanta Dream Exec Dan Gadd on Driving Fan Engagement and Growth, Serving the...
Atlanta Dream Exec Dan Gadd on Driving Fan Engagement and Growth, Serving the...Atlanta Dream Exec Dan Gadd on Driving Fan Engagement and Growth, Serving the...
Atlanta Dream Exec Dan Gadd on Driving Fan Engagement and Growth, Serving the...
 
Dubai Call Girls Bikni O528786472 Call Girls Dubai Ebony
Dubai Call Girls Bikni O528786472 Call Girls Dubai EbonyDubai Call Girls Bikni O528786472 Call Girls Dubai Ebony
Dubai Call Girls Bikni O528786472 Call Girls Dubai Ebony
 
Resultados del Campeonato mundial de Marcha por equipos Antalya 2024
Resultados del Campeonato mundial de Marcha por equipos Antalya 2024Resultados del Campeonato mundial de Marcha por equipos Antalya 2024
Resultados del Campeonato mundial de Marcha por equipos Antalya 2024
 
Presentation: The symbols of the Olympic Games
Presentation: The symbols of the Olympic  GamesPresentation: The symbols of the Olympic  Games
Presentation: The symbols of the Olympic Games
 
Stunning ➥8448380779▻ Call Girls In Delhi Cantt Delhi NCR
Stunning ➥8448380779▻ Call Girls In Delhi Cantt Delhi NCRStunning ➥8448380779▻ Call Girls In Delhi Cantt Delhi NCR
Stunning ➥8448380779▻ Call Girls In Delhi Cantt Delhi NCR
 
Plan d'orientations stratégiques rugby féminin
Plan d'orientations stratégiques rugby fémininPlan d'orientations stratégiques rugby féminin
Plan d'orientations stratégiques rugby féminin
 
JORNADA 4 LIGA MURO 2024TUXTEPEC1234.pdf
JORNADA 4 LIGA MURO 2024TUXTEPEC1234.pdfJORNADA 4 LIGA MURO 2024TUXTEPEC1234.pdf
JORNADA 4 LIGA MURO 2024TUXTEPEC1234.pdf
 
ppt on Myself, Occupation and my Interest
ppt on Myself, Occupation and my Interestppt on Myself, Occupation and my Interest
ppt on Myself, Occupation and my Interest
 

Advanced Database Systems - Presentation 3.pptx

  • 2. OVERVIEW Welcome to the first module of this course on the Advanced Database Systems! Understanding of SQL and its capabilities for querying a single table a prerequisite. In this subject, you will learn how to retrieve data from multiple tables using one SQL statement. You will see how tables can be joined together and how similar results are obtained using different approaches, including the joints and sub queries. It is important that you understand how to query multiple tables for generating appropriate reports in the creation of an information system. Advanced Database Systems
  • 3. SQL Statements 9/3/20XX Presentation Title 3 Advanced Database Systems
  • 4. 4 Advanced Database Systems SQL WHERE Clause The WHERE clause is used to filter records. It is used to extract only those records that fulfill a specified criterion. SQL WHERE Syntax: SELECT column_name(s) FROM table_name WHERE column_name operator value
  • 5. 5 Advanced Database Systems Example: WHERE Clause Table Name: Persons P_Id LastName FirstName Address City 1 Hansen Ola Timoteivn 10 Sandnes 2 Svendson Tove Borgvn 23 Sandnes 3 Pettersen Kari Storgt 20 Stavanger Now we want to select only the persons living in the city "Sandnes" from the table above. We use the following SELECT statement: SELECT * FROM Persons WHERE City='Sandnes' Or SELECT * FROM Persons WHERE City='Sandnes'
  • 6. 6 Advanced Database Systems The result-set will look like this: P_Id LastName FirstName Address City 1 Hansen Ola Timoteivn 10 Sandnes 2 Svendson Tove Borgvn 23 Sandnes
  • 7. 7 Advanced Database Systems Quotes around Text Fields SQL uses single quotes around text values (most database systems will also accept double quotes). However, numeric values should not be enclosed in quotes. For text values: • This is correct SELECT * FROM Persons WHERE FirstName='Tove'
  • 8. 8 Advanced Database Systems • This is wrong: SELECT * FROM Persons WHERE FirstName=Tove For numeric values: • This is correct: SELECT * FROM Persons WHERE Year=1965 • This is wrong: SELECT * FROM Persons WHERE Year='1965'
  • 9. 9 Advanced Database Systems Operators Allowed in the WHERE Clause With the WHERE clause, the following operators can be used: Operator Description = Equal <> Not equal > Greater than < Less than >= Greater than or equal <= Less than or equal BETWEEN Between an inclusive range LIKE Search for a pattern IN To specify multiple possible values for a column Note: In some versions of SQL the <> operator may be written as !=
  • 10. 10 Advanced Database Systems SQL DELETE Statement The DELETE statement is used to delete records 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!
  • 11. 11 Advanced Database Systems Now we want to delete the person "Tjessem, Jakob" in the "Persons" table. We use the following SQL statement: DELETE FROM Persons WHERE LastName='Tjessem' AND FirstName='Jakob’ The "Persons" table will now look like this: P_Id LastName FirstName Address City 1 Hansen Ola Timoteivn 10 Sandnes 2 Svendson Tove Borgvn 23 Sandnes 3 Pettersen Kari Storgt 20 Stavanger 4 Nilsen Johan Bakken 2 Stavanger
  • 12. 12 Advanced Database Systems Delete All Rows 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 Note: Be very careful when deleting records. You cannot undo this statement!
  • 13. Thank you Presenter name: Ellen Grace D. Porras Email address: egporras@psu.palawan.edu.ph This Photo by Unknown Author is licensed under CC BY-SA-NC