MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

SQL

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which would find pupils with “er” anywhere in their name?
A
SELECT * FROM Pupils Where Name = “%er”
B
SELECT * FROM Pupils Where Name = “$er$”
C
SELECT * FROM Pupils Where Name = “%er%”
D
SELECT * FROM Pupils Where Name = “er%”
Explanation: 

Detailed explanation-1: -Or you can specify, select first, last from empinfo where last LIKE ‘%s’; This statement will match any last names that end in a ‘s’.

Detailed explanation-2: -The SQL statement would be: ename like ‘S%S’ .

Detailed explanation-3: -Write an SQL query to fetch worker names with salaries >= 50000 and <= 100000. Ans. The required query is: SELECT CONCAT(FIRST NAME, ‘ ‘, LAST NAME) As Worker Name, Salary FROM worker WHERE WORKER ID IN (SELECT WORKER ID FROM worker WHERE Salary BETWEEN 50000 AND 100000);

There is 1 question to complete.