If We want to check multiple static values in condition not exists.
WHERE column_name NOT IN (value1, value2, ...);
Top 100+ Sql Server Interview Questions
NOT IN Operator
SYNTAX
SELECT col_name
FROM table_nameWHERE column_name NOT IN (value1, value2, ...);
QUERY-
SELECT * FROM Customers
WHERE Country NOT IN ('DELHI', 'MUMBAI', 'SHIMLA');'
IN Operator
If We want to check multiple static values in condition.
WHERE column_name IN (value1, value2, ...);
WHERE Country NOT IN ('DELHI', 'MUMBAI', 'SHIMLA');'
IN Operator
If We want to check multiple static values in condition.
SYNTAX
SELECT col_name
FROM table_nameWHERE column_name IN (value1, value2, ...);
QUERY-
SELECT * FROM Customers
WHERE Country IN ('DELHI', 'MUMBAI', 'SHIMLA');
WHERE Country IN ('DELHI', 'MUMBAI', 'SHIMLA');
No comments:
Post a Comment