sql where in list

Today, We want to share with you sql where in list.In this post we will show you sql where multiple values, hear for sql list variable we will give you demo and example for implement.In this post, we will learn about sql list of strings with an example.

sql where multiple conditions

In this tutorial we learn to all about sql where in list Examples like as a ALTER TABLE, SQL IN Operator, statement selects, subquery in sql, AND, AVG(), BETWEEN, CASE, COUNT(), DELETE or many more.


Also Read: MySQL WHERE Clause with AND, OR, IN, NOT IN

SQL WHERE IN Examples

SELECT Id, CompanyName, Location, Districts
  FROM Supplier
 WHERE Districts IN ('Rajkot', 'Ahemdabad', 'Baroda')

The SQL IN Operator

SELECT * FROM Members
WHERE Districts IN ('Jammnagar', 'Surat', 'Ahemdabad');

NOT IN Operator Examples

SELECT * FROM Members
WHERE Districts NOT IN ('Jammnagar', 'Surat', 'Ahemdabad');

SQL statement selects

SELECT * FROM Members
WHERE Districts IN (SELECT Districts FROM Suppliers);

subquery in sql

SELECT
    mobile_name,
    list_price
FROM
    mobileion.mobiles
WHERE
    mobile_id IN (
        SELECT
            mobile_id
        FROM
            mobileion.stocks
        WHERE
            store_id = 1 AND quantity >= 30
    )
ORDER BY
    mobile_name;

ALTER TABLE

ALTER TABLE tamilrokers_tbl 
ADD tbl_clmdata_nm datatype;

AND

SELECT tbl_clmdata_nm(s)
FROM tamilrokers_tbl
WHERE column_1 = value_1
  AND column_2 = value_2;

AVG()

SELECT AVG(tbl_clmdata_nm)
FROM tamilrokers_tbl;

BETWEEN

SELECT tbl_clmdata_nm(s)
FROM tamilrokers_tbl
WHERE tbl_clmdata_nm BETWEEN value_1 AND value_2;

CASE

SELECT tbl_clmdata_nm,
  CASE
    WHEN condition THEN 'Result_1'
    WHEN condition THEN 'Result_2'
    ELSE 'Result_3'
  END
FROM tamilrokers_tbl;

COUNT()

SELECT COUNT(tbl_clmdata_nm)
FROM tamilrokers_tbl;

CREATE TABLE

CREATE TABLE tamilrokers_tbl (
  column_1 datatype, 
  column_2 datatype, 
  column_3 datatype
);

DELETE

DELETE FROM tamilrokers_tbl
WHERE some_column = some_value;

GROUP BY

SELECT tbl_clmdata_nm, COUNT(*)
FROM tamilrokers_tbl
GROUP BY tbl_clmdata_nm;

HAVING

SELECT tbl_clmdata_nm, COUNT(*)
FROM tamilrokers_tbl
GROUP BY tbl_clmdata_nm
HAVING COUNT(*) > value;

INNER JOIN

SELECT tbl_clmdata_nm(s)
FROM table_1
JOIN table_2
  ON table_1.tbl_clmdata_nm = table_2.tbl_clmdata_nm;

INSERT

INSERT INTO tamilrokers_tbl (column_1, column_2, column_3) 
VALUES (value_1, 'value_2', value_3);

IS NULL / IS NOT NULL

SELECT tbl_clmdata_nm(s)
FROM tamilrokers_tbl
WHERE tbl_clmdata_nm IS NULL;

LIKE

SELECT tbl_clmdata_nm(s)
FROM tamilrokers_tbl
WHERE tbl_clmdata_nm LIKE pattern;

LIMIT

SELECT tbl_clmdata_nm(s)
FROM tamilrokers_tbl
LIMIT number;

MAX()

SELECT MAX(tbl_clmdata_nm)
FROM tamilrokers_tbl;

MIN()

SELECT MIN(tbl_clmdata_nm)
FROM tamilrokers_tbl;

OR

SELECT tbl_clmdata_nm
FROM tamilrokers_tbl
WHERE tbl_clmdata_nm = value_1
   OR tbl_clmdata_nm = value_2;

ORDER BY

SELECT tbl_clmdata_nm
FROM tamilrokers_tbl
ORDER BY tbl_clmdata_nm ASC | DESC;

OUTER JOIN

SELECT tbl_clmdata_nm(s)
FROM table_1
LEFT JOIN table_2
  ON table_1.tbl_clmdata_nm = table_2.tbl_clmdata_nm;

ROUND()

SELECT ROUND(tbl_clmdata_nm, integer)
FROM tamilrokers_tbl;

SELECT

SELECT tbl_clmdata_nm 
FROM tamilrokers_tbl;

SELECT DISTINCT

SELECT DISTINCT tbl_clmdata_nm
FROM tamilrokers_tbl;

SUM

SELECT SUM(tbl_clmdata_nm)
FROM tamilrokers_tbl;

UPDATE

UPDATE tamilrokers_tbl
SET some_column = some_value
WHERE some_column = some_value;

WHERE

SELECT tbl_clmdata_nm(s)
FROM tamilrokers_tbl
WHERE tbl_clmdata_nm operator value;

WITH

WITH temporary_name AS (
   SELECT *
   FROM tamilrokers_tbl)
SELECT *
FROM temporary_name
WHERE tbl_clmdata_nm operator value;

I hope you get an idea about sql where in list.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.