SQL output question | The Moonfrog Lab interview question

Question

SELECT ‘NITIN’+1

SELECT ‘NITIN’+’1’

SELECT(SELECT ‘NITIN’)

SELECT ‘1’+1

SELECT 1+’1’

solved 3
TheDataMonk 55 years 18 Answers 2283 views Grand Master 1

Answers ( 18 )

  1. Sorry it a private answer.

  2. a) 1
    b) 1
    c)Nitin
    d) 2
    e) 2

  3. SELECT ‘NITIN’+1: Error (string to, int datatype conversion )

    SELECT ‘NITIN’+’1’: NITIN1

    SELECT(SELECT ‘NITIN’) : NITIN

    SELECT ‘1’+1: 2 (‘1’ can be converted to 1)

    SELECT 1+’1’: 2

  4. SELECT ‘NITIN’+1: error (can’t convert string to int)

    SELECT ‘NITIN’+’1’: NITIN1

    SELECT(SELECT ‘NITIN’): NITIN

    SELECT ‘1’+1: 2

    SELECT 1+’1’: 2

  5. SELECT ‘NITIN’+1 – Error
    SELECT ‘NITIN’+’1’ – NITIN1
    SELECT(SELECT ‘NITIN’) – NITIN
    SELECT ‘1’+1 : 2
    SELECT 1+’1’ : 2

  6. 1) Error
    2) NITIN1
    3) NITIN
    4) 2
    5) 2

  7. SELECT ‘NITIN’+1 :- Error
    SELECT ‘NITIN’+’1’ :– NITIN1
    SELECT(SELECT ‘NITIN’) :– NITIN
    SELECT ‘1’+1 :- 2
    SELECT 1+’1’ :- 2

  8. ERROR
    NITIN1
    NITIN
    2
    2

  9. ERROR
    NITIN1
    NITIN
    2
    2

  10. 1. Error
    2. Nitin1
    3. Nitin
    4. 2
    5. 2

  11. 1. output: 1
    2. output : 1
    3. output: NITIN
    4. output: 2
    5. output: 2

  12. 1. 1
    2. 1
    3. NITIN
    4. 2
    5. 2

  13. Error
    NITIN1
    NITIN
    2
    2

  14. 1. Error – Can’t Convert varchar value ‘NITIN’ to Int Datatype
    2. NITIN1 – Since both are of string datatype
    3. NITIN
    4. 2
    5. 2

  15. 1. Error
    2. NITIN1
    3. NITIN
    4. 2
    5. 2

  16. A string cannot be combined with numeric number. Therefore, error.
    Then, Nitin1 (in this case ‘1’ implies 1 is now a string)
    Then, 2
    Then, 2

Leave an answer

Browse
Browse