Examveda
Examveda

Which of the following SQL query is correct for selecting the name of staffs from 'staffinfo' table where salary is 10,000 or 25,000?

A. SELECT name FROM staffinfo WHERE salary BETWEEN 10000 AND 25000;

B. SELECT name FROM staffinfo WHERE salary IN (10000, 25000);

C. Both A and B

D. None of the above

Answer: Option B

Solution(By Examveda Team)

SELECT name FROM staffinfo WHERE salary IN (10000, 25000);

This query correctly selects the names of staff members whose salary is either 10,000 or 25,000. The correct answer is Option B because it selects the names of staffs with salaries of 10,000 or 25,000, as required by the question.

This Question Belongs to SQL >> Sql Miscellaneous

Join The Discussion

Comments ( 4 )

  1. Sreeja Poreddy
    Sreeja Poreddy :
    1 year ago

    i think both a&b are true

  2. Gibran Alves
    Gibran Alves :
    2 years ago

    I marked a wrong answer, but now I know the difference: between will list the values between 10000 and 25000, example: 10000, 10001, 10002, 10003, ... , 24998, 24999, 25000.

    Meanwhile the in clause just select these two values, example: 10000, 25000 -> works like a "or"

  3. Mahendra Pal
    Mahendra Pal :
    5 years ago

    only those records fetch which specific salary arguments provided in statement.

  4. Abhishek Thakur
    Abhishek Thakur :
    7 years ago

    it matches the list and where we have two items in list. so it is true

Related Questions on Sql Miscellaneous