All for Joomla All for Webmasters

SQL SELECT IN

SQL IN is an operator used in a SQL query to help reduce the need to use multiple SQL “OR” conditions.

It is used in SELECT, INSERT, UPDATE or DELETE statement.


Advantage of SQL SELECT IN

It minimizes the use of SQL OR operator.


Let’s see the syntax for SQL IN:

  1. Expression IN (value 1, value 2 … value n);

Take an example with character values.

  1. SELECT *
  2. FROM students
  3. WHERE students_name IN ( Amit , Raghav, Rajeev)

Let?s take another example with numeric values.

  1. SELECT *
  2. FROM marks
  3. WHERE roll_no IN (001, 023, 024);
PinIt
submit to reddit

Leave a Reply

Top