Exercise on SQL LIKE query
SQL querying data SELECT WHERE LIKE
SQL dump of Student table
Display all records who’s name starts with John
Display all records who’s name ends with John
Display all records who’s name have John ( can be any where )
Display all records who’s name starts with A and ends with n
Display all records who’s name have no ( case sensitive )
Display all records who got mark in nineties but not equal to 100
Display all records who have alex or deo any where in name column
Display all records who have alex and Jon any where in name column
Display all records who have alex or Jon any where in name column
Display all records who have ro any where in name column and got mark in nineties
Solution : can be used as SQL file
Create Sample table SQL file
Video Tutorial on LIKE Query with AND , OR NOT combinations.
VIDEO
Solution ( Query )
USE my_db;
SELECT * FROM student WHERE name LIKE 'John%'; # 1 , starting with John
SELECT * FROM student WHERE name LIKE '%John'; # 2 , ending with John
SELECT * FROM student WHERE name LIKE '%John%'; # 3 , Any where John is there
SELECT * FROM student WHERE name LIKE 'A%n'; # 4 , Starts with A and ends with n
SELECT * FROM student WHERE name LIKE binary '%no%'; # 5 , Case sensitive search
SELECT * FROM student WHERE mark LIKE '9_'; # 6 , Mark in nineties
SELECT * FROM student WHERE name LIKE '%alex%' OR name like '%deo%'; # 7 , alex or deo
SELECT * FROM student WHERE name LIKE '%alex%' AND name like '%John%'; # 8 , alex and John
SELECT * FROM student WHERE name LIKE '%alex%' OR name like '%John%'; # 9 , alex OR John
SELECT * FROM student WHERE name LIKE '%ro%' AND mark LIKE '9_'; # 10 , ro AND Mark in nineties
More Questions on SELECT UPDATE Queries
← Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
https://www.plus2net.com
plus2net.com