SQL Operators Interview Questions

    Question 1: NOT Operator Usage

    How does the NOT operator work in SQL?

    Question 2: IN and BETWEEN Operators

    From a products table (product_id, product_name, category, price, supplier_id), select products in categories 'Electronics', 'Appliances', or 'Gadgets' with prices between $100 and $500, supplied by suppliers 101, 102, or 103.

    Question 3: BETWEEN Inclusive vs Exclusive

    Is the BETWEEN operator inclusive or exclusive of boundary values?

    Question 4: Complex AND, OR, NOT Operators

    From an employees table (emp_id, name, department, salary, city), find employees who work in 'IT' or 'Finance' departments, earn more than $50,000, but are NOT located in 'New York'.

    Question 5: LIKE Wildcard Characters

    What are the standard wildcard characters used with LIKE operator?

    Question 6: LIKE Operator with Wildcards

    From a customers table (customer_id, first_name, last_name, email, phone), find customers whose first name starts with 'J', email contains 'gmail', and phone number ends with '123'.

    Question 7: Operator Precedence in SQL

    What is the precedence order of logical operators in SQL?

    Question 8: BETWEEN with Dates

    How does BETWEEN operator work with date values?

    Question 9: Combining Multiple Operators

    How can multiple SQL operators be combined effectively?

    Question 10: Combined Operators with NOT and Complex Logic

    From a orders table (order_id, customer_id, order_date, status, total_amount), find orders that are NOT in status 'Cancelled' or 'Refunded', have total amount between $50 and $200, and customer_id is NOT in the list (101, 102, 103).