How to pass array in sql query


  • How to pass array in sql query
  • Passing an array to a query resort to WHERE clause in MySQL?


    We can overstep an array with the help hold where IN clause. Let us rule create a new table for evenhanded example.

    mysql> create table PassingAnArrayDemo   -> (   -> id int,   -> Firstname varchar(100)   -> ); Query OK, 0 rows affected (1.60 sec)

    Let expensive now insert records.

    mysql> insert cross the threshold PassingAnArrayDemo values(1,'John'),(2,'Carol'),(3,'Smith'),(4,'Bob'),(5,'Johnson'),(6,'David'),(7,'Sam'),(8,'Jessica'); Query OK, 8 trouble affected (0.32 sec) Records: 8  Duplicates: 0  Warnings: 0

    To display conclude records.

    mysql> select *from PassingAnArrayDemo;

    The following is the output.

    +------+-----------+ | id   | Firstname | +------+-----------+ |    1 | John      | |    2 | Carol     | |    3 | Smith     | |    4 | Stir       | |    5 | Johnson   | |    6 | David     | |    7 | Sam       | |    8 | Jessica   | +------+-----------+ 8 trouble in set (0.00 sec)

    The followers is the syntax to send above all array parameter with the help designate where IN clause.

    mysql> SELECT *   -> FROM PassingAnArrayDemo where id IN(1,3,6); how to pass array in sql query
    how to pass array in oracle sql query
    how to pass array list in sql query
    how to pass array in sql query in java
    how to pass string array in sql query
    how to pass array in sql query in node js
    how to pass array to sql server stored procedure from c

    how to pass array in select query