MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

SQL

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which SQL query would display all pupils who 12 years old or order and have the surname Smith?
A
SELECT * FROM Pupils WHERE Age >= 12 AND Surname = “Smith”
B
SELECT * FROM Pupils WHERE Age >= 12 AND Surname = Smith
C
SELECT * FROM Pupils WHERE Age > 12 AND Surname = “Smith”
D
SELECT * FROM Pupils
Explanation: 

Detailed explanation-1: -SELECT statement uses * character to retrieve all records from a table, for all the columns. The above query will show all the records of student table, that means it will show complete dataset of the table.

Detailed explanation-2: -21. What SQL statement do we use to print out the records of all students whose first name or last name ends in ‘A’? Correct Answer: a) SELECT * FROM EXAM RESULTS WHERE FIRST NAME LIKE ‘%A’ OR LAST NAME LIKE ‘%A’;

Detailed explanation-3: -SELECT statements An SQL SELECT statement retrieves records from a database table according to clauses (for example, FROM and WHERE ) that specify criteria. The syntax is: SELECT column1, column2 FROM table1, table2 WHERE column2=’value’;

There is 1 question to complete.