SlideShare a Scribd company logo
1 of 19
SQL Statements
INSTRUCTOR:
ELLEN GRACE
PORRAS
SECOND SEMESTER 2022-2023
2
Table Name: Students
Student_I
D
Firstname Lastname Age Allowance
1100 Fernan Cabuso 22 400
1101 Joshua Guimaras 22 500
1102 Joyce Hisona 21 500
1103 Andrea Laki 20 600
3
SQL Aliases
SQL aliases are used to give a table, or a column in a table,
a temporary name. Aliases are often used to make column
names more readable. An alias only exists for the duration
of that query. An alias is created with the AS keyword.
4
Table Name: Students
Student_I
D
Firstname Lastname Age Allowance
1100 Fernan Cabuso 22 400
1101 Joshua Guimaras 22 500
1102 Joyce Hisona 21 500
1103 Andrea Laki 20 600
Example: Alias
SELECT Student_ID AS ID
FROM Students
5
Table Name: Students
Student_I
D
Firstname Lastname Age Allowance
1100 Fernan Cabuso 22 400
1101 Joshua Guimaras 22 500
1102 Joyce Hisona 21 500
1103 Andrea Laki 20 600
Example: Alias
Select Student_ID as ID, Firstname as Pangalan
from Employees
6
The SQL LIKE Operator
The LIKE operator is used in a WHERE clause to search for a
specified pattern in a column.
There are two wildcards often used in conjunction with
the LIKE operator:
• The percent sign (%) represents zero, one, or multiple characters
• The underscore sign (_) represents one, single character
• The percent sign and the underscore can also be used in
combinations!
7
LIKE Operator Description
WHERE Student_Name LIKE 'a%' Finds any values that start with "a"
WHERE Student_Name LIKE '%a' Finds any values that end with "a"
WHERE Student_Name LIKE
'%or%'
Finds any values that have "or" in any position
WHERE Student_Name LIKE '_r%' Finds any values that have "r" in the second position
WHERE Student_Name LIKE 'a_%'
Finds any values that start with "a" and are at least 2
characters in length
WHERE Student_Name LIKE
'a__%'
Finds any values that start with "a" and are at least 3
characters in length
WHERE Student_Name LIKE 'a%o' Finds any values that start with "a" and ends with "o"
Here are some examples showing different LIKE operators with '%' and '_' wildcards:
8
Example: LIKE Operator
 The following SQL statement selects all records in
Students Table with a FirstName starting with “J".
We use the following LIKE statement:
9
Table Name: Students
Student_I
D
Firstname Lastname Age Allowance
1100 Fernan Cabuso 22 400
1101 Joshua Guimaras 22 500
1102 Joyce Hisona 21 500
1103 Andrea Laki 20 600
Example: Like
SELECT *
FROM Students
WHERE FirstName LIKE ‘J%’;
10
 The following SQL statement selects all
records in Students Table with a LastName
ending with “s". We use the following LIKE
statement:
11
Table Name: Students
Student_I
D
Firstname Lastname Age Allowance
1100 Fernan Cabuso 22 400
1101 Joshua Guimaras 22 500
1102 Joyce Hisona 21 500
1103 Andrea Laki 20 600
Example: Like
SELECT *
FROM Students
WHERE Lastname LIKE ‘%s’;
12
 The following SQL statement selects all
records in Students Table with Firstname
that have “Jo” in any position. We use the
following LIKE statement:
13
Table Name: Students
Student_I
D
Firstname Lastname Age Allowance
1100 Fernan Cabuso 22 400
1101 Joshua Guimaras 22 500
1102 Joyce Hisona 21 500
1103 Andrea Laki 20 600
Example: Like
SELECT *
FROM Persons
WHERE City LIKE ‘%Jo%’;
14
 The following SQL statement selects all
records in Students Table with a Firstname that
have “O” in the second position. We use the
following LIKE statement:
15
Table Name: Students
Student_I
D
Firstname Lastname Age Allowance
1100 Fernan Cabuso 22 400
1101 Joshua Guimaras 22 500
1102 Joyce Hisona 21 500
1103 Andrea Laki 20 600
Example: Like
SELECT *
FROM Students
WHERE FirstName LIKE ‘_O%’;
16
 The following SQL statement selects all
records in Students Table with a Firstname
that starts with “j” and ends with “a”. We
use the following LIKE statement:
17
Table Name: Students
Student_I
D
Firstname Lastname Age Allowance
1100 Fernan Cabuso 22 400
1101 Joshua Guimaras 22 500
1102 Joyce Hisona 21 500
1103 Andrea Laki 20 600
Example: Like
SELECT *
FROM Students
WHERE FirstName LIKE ‘j%a’;
18
The following SQL statement selects
all records in Students Table with a
Firstname that does not starts with “j”.
We use the following LIKE statement:
19
Table Name: Students
Student_I
D
Firstname Lastname Age Allowance
1100 Fernan Cabuso 22 400
1101 Joshua Guimaras 22 500
1102 Joyce Hisona 21 500
1103 Andrea Laki 20 600
Example: Like
SELECT *
FROM Students
WHERE FirstName NOT LIKE ‘j%’;

More Related Content

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 3.pptx
Advanced Database Systems - Presentation 3.pptxAdvanced Database Systems - Presentation 3.pptx
Advanced Database Systems - Presentation 3.pptxEllenGracePorras
 
Advanced Database Systems - Presentation 2.pptx
Advanced Database Systems - Presentation 2.pptxAdvanced Database Systems - Presentation 2.pptx
Advanced Database Systems - Presentation 2.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
 
Structured Query Language (SQL).pptx
Structured Query Language (SQL).pptxStructured Query Language (SQL).pptx
Structured Query Language (SQL).pptxEllenGracePorras
 

More from EllenGracePorras (17)

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 3.pptx
Advanced Database Systems - Presentation 3.pptxAdvanced Database Systems - Presentation 3.pptx
Advanced Database Systems - Presentation 3.pptx
 
Advanced Database Systems - Presentation 2.pptx
Advanced Database Systems - Presentation 2.pptxAdvanced Database Systems - Presentation 2.pptx
Advanced Database Systems - Presentation 2.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
 
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
 
Structured Query Language (SQL).pptx
Structured Query Language (SQL).pptxStructured Query Language (SQL).pptx
Structured Query Language (SQL).pptx
 

Recently uploaded

Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsAndrey Dotsenko
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 

Recently uploaded (20)

Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 

SQL Statements.pptx

  • 2. 2 Table Name: Students Student_I D Firstname Lastname Age Allowance 1100 Fernan Cabuso 22 400 1101 Joshua Guimaras 22 500 1102 Joyce Hisona 21 500 1103 Andrea Laki 20 600
  • 3. 3 SQL Aliases SQL aliases are used to give a table, or a column in a table, a temporary name. Aliases are often used to make column names more readable. An alias only exists for the duration of that query. An alias is created with the AS keyword.
  • 4. 4 Table Name: Students Student_I D Firstname Lastname Age Allowance 1100 Fernan Cabuso 22 400 1101 Joshua Guimaras 22 500 1102 Joyce Hisona 21 500 1103 Andrea Laki 20 600 Example: Alias SELECT Student_ID AS ID FROM Students
  • 5. 5 Table Name: Students Student_I D Firstname Lastname Age Allowance 1100 Fernan Cabuso 22 400 1101 Joshua Guimaras 22 500 1102 Joyce Hisona 21 500 1103 Andrea Laki 20 600 Example: Alias Select Student_ID as ID, Firstname as Pangalan from Employees
  • 6. 6 The SQL LIKE Operator The LIKE operator is used in a WHERE clause to search for a specified pattern in a column. There are two wildcards often used in conjunction with the LIKE operator: • The percent sign (%) represents zero, one, or multiple characters • The underscore sign (_) represents one, single character • The percent sign and the underscore can also be used in combinations!
  • 7. 7 LIKE Operator Description WHERE Student_Name LIKE 'a%' Finds any values that start with "a" WHERE Student_Name LIKE '%a' Finds any values that end with "a" WHERE Student_Name LIKE '%or%' Finds any values that have "or" in any position WHERE Student_Name LIKE '_r%' Finds any values that have "r" in the second position WHERE Student_Name LIKE 'a_%' Finds any values that start with "a" and are at least 2 characters in length WHERE Student_Name LIKE 'a__%' Finds any values that start with "a" and are at least 3 characters in length WHERE Student_Name LIKE 'a%o' Finds any values that start with "a" and ends with "o" Here are some examples showing different LIKE operators with '%' and '_' wildcards:
  • 8. 8 Example: LIKE Operator  The following SQL statement selects all records in Students Table with a FirstName starting with “J". We use the following LIKE statement:
  • 9. 9 Table Name: Students Student_I D Firstname Lastname Age Allowance 1100 Fernan Cabuso 22 400 1101 Joshua Guimaras 22 500 1102 Joyce Hisona 21 500 1103 Andrea Laki 20 600 Example: Like SELECT * FROM Students WHERE FirstName LIKE ‘J%’;
  • 10. 10  The following SQL statement selects all records in Students Table with a LastName ending with “s". We use the following LIKE statement:
  • 11. 11 Table Name: Students Student_I D Firstname Lastname Age Allowance 1100 Fernan Cabuso 22 400 1101 Joshua Guimaras 22 500 1102 Joyce Hisona 21 500 1103 Andrea Laki 20 600 Example: Like SELECT * FROM Students WHERE Lastname LIKE ‘%s’;
  • 12. 12  The following SQL statement selects all records in Students Table with Firstname that have “Jo” in any position. We use the following LIKE statement:
  • 13. 13 Table Name: Students Student_I D Firstname Lastname Age Allowance 1100 Fernan Cabuso 22 400 1101 Joshua Guimaras 22 500 1102 Joyce Hisona 21 500 1103 Andrea Laki 20 600 Example: Like SELECT * FROM Persons WHERE City LIKE ‘%Jo%’;
  • 14. 14  The following SQL statement selects all records in Students Table with a Firstname that have “O” in the second position. We use the following LIKE statement:
  • 15. 15 Table Name: Students Student_I D Firstname Lastname Age Allowance 1100 Fernan Cabuso 22 400 1101 Joshua Guimaras 22 500 1102 Joyce Hisona 21 500 1103 Andrea Laki 20 600 Example: Like SELECT * FROM Students WHERE FirstName LIKE ‘_O%’;
  • 16. 16  The following SQL statement selects all records in Students Table with a Firstname that starts with “j” and ends with “a”. We use the following LIKE statement:
  • 17. 17 Table Name: Students Student_I D Firstname Lastname Age Allowance 1100 Fernan Cabuso 22 400 1101 Joshua Guimaras 22 500 1102 Joyce Hisona 21 500 1103 Andrea Laki 20 600 Example: Like SELECT * FROM Students WHERE FirstName LIKE ‘j%a’;
  • 18. 18 The following SQL statement selects all records in Students Table with a Firstname that does not starts with “j”. We use the following LIKE statement:
  • 19. 19 Table Name: Students Student_I D Firstname Lastname Age Allowance 1100 Fernan Cabuso 22 400 1101 Joshua Guimaras 22 500 1102 Joyce Hisona 21 500 1103 Andrea Laki 20 600 Example: Like SELECT * FROM Students WHERE FirstName NOT LIKE ‘j%’;