Share
SQL Interview Questions | Output of Functions
Question
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Could you tell output or result of following SQL statements?
(Hint- In some cases, there may be an error. So, try to locate them and answer accordingly)
select 5
select ‘5’
select count (‘5’)
select count (5)
select count (*)
Answers ( 3 )
Output
Select 5 – 5
select ‘5’ – 5
select Count(5) – 1
select Count(‘5’) – 1
select count(*) – 1 ;count(*) Returns the number of rows in a specified Table
Output:
SELECT 5 :- 5
SELECT ‘5’ :- 5
SELECT COUNT(5) :- 1
SELECT COUNT(‘5’) :- 1
SELECT COUNT(*) :- 1
Point to be known is that there is no difference between last 3 queries, they will always return identical results, wherever they are used.
select 5 – 5
select ‘5’ – 5
select count (‘5’) – 1
select count (5) – 1
select count (*) – 1