1.

With SQL, how do you select all the records from a table named “Persons” where the value of the column “FirstName” ends with an “a”?(a) SELECT * FROM Persons WHERE FirstName=’a’(b) SELECT * FROM Persons WHERE FirstName LIKE ‘a%’(c) SELECT * FROM Persons WHERE FirstName LIKE ‘%a’(d) SELECT * FROM Persons WHERE FirstName=’%a%’This question was addressed to me in an internship interview.Enquiry is from Basic SQL topic in portion Laying the Foundation of SQL Server

Answer»

Right answer is (c) SELECT * FROM PERSONS WHERE FirstName LIKE ‘%a’

Explanation: The SQL LIKE clause is used to compare a VALUE to SIMILAR values using wildcard OPERATORS.



Discussion

No Comment Found

Related InterviewSolutions