Some times if we want to update a table or query a table for multiple values in a single column we have to run our simple sql query multiple times. Suppose if you want to get an element value in a column of a table you normally run a select command as shown below.
SELECT * FROM `table1` where column='abc'
SELECT * FROM `table1` where column is 'abc'
But if we want to select multiple values of a given column the above statement will not work properly. We have to modify to accomplish that. We can use in SQL keyword to achive this. Below example shows on how to select multiple values in a given column.
SELECT * FROM `table1` where column in ( 'element1', 'element2', 'element3')
We can include as many element you want in those braces.
Latest posts by Surendra Anne (see all)
- Online training on Linux Bash shell scripting - February 8, 2018
- 15 iostat command examples in Linux/Unix - December 4, 2017
- How to Installing and Configuring Firewalld on Linux - November 29, 2017
- 4 sleep command examples in Linux/Unix - November 2, 2017
- 5 SSH alias examples in Linux - October 16, 2017