SQL like search string starts with

0 votes

Studying SQL. Have a straightforward table game with a field name. I want to perform a title-based search. The search returns the record with that name if I have a game called Age of Empires III: Dynasties and I use LIKE with the parameter Age of Empires III: Dynasties. However, a search in Age of Empires III yields no results:

SELECT * from games WHERE (lower(title) LIKE 'age of empires III');

This doesn't return anything. Should I be using something else instead of LIKE?

Sep 17 in Database by Kithuzzz
• 12,240 points
24 views

1 answer to this question.

0 votes
SELECT * from games WHERE (lower(title) LIKE 'age of empires III');

Because the exact string "age of empires III" isn't found in any records, the query mentioned above doesn't provide any results.

Therefore, you must use "%your string goes here%" to match this string with another string with "age of empires" as a substring.

More on MySQL string comparison

Try this

SELECT * from games WHERE (lower(title) LIKE '%age of empires III%');

In Like '%age of empires III%' this will search for any matching substring in your rows, and it will show in results.

answered Sep 18 by narikkadan
• 20,880 points

Related Questions In Database

0 votes
0 answers

If Cell Starts with Text String... Formula

I have formula that checks if the ...READ MORE

Feb 24 in Database by Edureka
• 13,640 points
315 views
0 votes
2 answers

Write a SQL query to find the names of employees that begin with ‘S’

Select ename From emp Where ename like"s%"; READ MORE

answered Oct 7, 2021 in Database by anonymous
14,703 views
0 votes
1 answer

How will I get all the rows from my table where name starts with 's' and ending with 'I'?

Hi Santanu, I understand your problem, You can try ...READ MORE

answered May 28, 2019 in Database by sampriti
• 1,120 points
650 views
0 votes
1 answer

two back slash in SQL procedure with Regular expression

It's the escape prefix in regular expressions: ...READ MORE

answered Feb 2 in Database by Vaani
• 7,020 points
511 views
0 votes
1 answer

Which query to use for better performance, join in SQL or using Dataset API?

DataFrames and SparkSQL performed almost about the ...READ MORE

answered Apr 19, 2018 in Apache Spark by kurt_cobain
• 9,390 points
1,000 views
0 votes
1 answer

How to connect Java program to the MySQL database?

You can connect your Java code with ...READ MORE

answered May 11, 2018 in Java by Parth
• 4,630 points
935 views
0 votes
1 answer
0 votes
1 answer

Automating Oracle script with nolio

Depending upon the details of your script ...READ MORE

answered Jul 17, 2018 in Other DevOps Questions by ajs3033
• 7,280 points
360 views
0 votes
1 answer

Login failed for user 'sa'. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452) in sql 2008

Solution Go to Start > Programs > Microsoft SQL Server > Enterprise Manager. Right-click the SQL ...READ MORE

answered Sep 12 in Database by narikkadan
• 20,880 points
39 views
0 votes
1 answer

Add a column with a default value to an existing table in SQL Server

Syntax: ALTER TABLE {TABLENAME} ADD {COLUMNNAME} {TYPE} {NULL|NOT ...READ MORE

answered Sep 12 in Database by narikkadan
• 20,880 points
63 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP