1

Example - Sub string is "ab" And if the contents are

abhi
babu
abdullah

Then after running the query I should be getting only the values

abhi 
abdullah

Even though value 'babu' contains the sub string ab

Suppose the table name is person and the column name is name

2 Answers 2

2

You can use LIKE operator like this:

SELECT * FROM person
WHERE name LIKE 'ab%'

If you add % ahead of ab then babu will also come in result so only add % after ab.

Sign up to request clarification or add additional context in comments.

Comments

1

Use sql LIKE operator

SELECT name FROM person WHERE name LIKE 'ab%'

above query return all name starting with ab, if you want to get names like hiabhi use like this

SELECT name FROM person WHERE name LIKE '%ab%'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.