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.
Join The Discussion
Comments ( 4 )
Related Questions on Sql Miscellaneous
A. Structured Query Language
B. Structured Query List
C. Simple Query Language
D. None of these
Which is the subset of SQL commands used to manipulate Oracle Database structures, including tables?
A. Data Definition Language(DDL)
B. Data Manipulation Language(DML)
C. Both of above
D. None
Which operator performs pattern matching?
A. BETWEEN operator
B. LIKE operator
C. EXISTS operator
D. None of these
What operator tests column for the absence of data?
A. EXISTS operator
B. NOT operator
C. IS NULL operator
D. None of these
i think both a&b are true
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"
only those records fetch which specific salary arguments provided in statement.
it matches the list and where we have two items in list. so it is true