Back

Explore Courses Blog Tutorials Interview Questions
0 votes
4 views
in SQL by (6.1k points)

I want to use string like  'Apple's' in SQL "IN" clause query.

example:

select * from tbl_fruit where nm_fruit IN(''Apple's'','Orange');

How to make the above query work correctly ?

1 Answer

0 votes
by (12.7k points)
edited by

Double the single quotes,

select * from tbl_fruit where nm_fruit IN ('Apple''s', 'Orange')

but if you do it on the application level, make sure you parameterized the query.

If you want to learn more about SQLCheck out this SQL online course by Intellipaat.

For more information visit :

Related questions

0 votes
1 answer
asked Nov 28, 2020 in SQL by Appu (6.1k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Nov 26, 2020 in SQL by Appu (6.1k points)
0 votes
1 answer

Browse Categories

...