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)
- Review: Whizlabs Practice Tests for AWS Certified Solutions Architect Professional (CSAP) - August 27, 2018
- How to use ohai/chef-shell to get node attributes - July 19, 2018
- wget download a file to a directory in Linux/Unix - June 4, 2018
- GIT: How to compare two GIT branches? - June 3, 2018
- Online training on Linux Bash shell scripting - February 8, 2018