Get data from table from list of rows in MySQL

How can I query data from a table available in a list of rows?

I only want to get data from a list of strings.

Example:
Table
ID Name
1  Big
2  Small
3  Extra
4  Orange
5  Drink

List of Strings:
Big
Small
Extra

      

Thanks!

+2


a source to share


2 answers


I assume you want the MySQL IN clause :



SELECT ID, Name FROM TableName WHERE Name IN ('Big','Small','Extra')

      

+3


a source


SELECT * FROM theTable WHERE column_name IN ('Big', 'Small', 'Extra')

      



+2


a source







All Articles