SQL Interview Questions | Output of Functions

Question

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 (*)

in progress 0
Dhruv2301 55 years 3 Answers 1185 views Great Grand Master 0

Answers ( 3 )

  1. 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

  2. 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.

  3. select 5 – 5

    select ‘5’ – 5

    select count (‘5’) – 1

    select count (5) – 1

    select count (*) – 1

Leave an answer

Browse
Browse