+

SQL SERVER objective interview questions and answers

Can this query be executed and is it useful (according to the table and column definitions)? SELECT CTITLE, CID FROM COURSES WHERE CID = ’7820′

  • Query cannot be executed (gives a syntax error).
  • Query can be executed and makes sense (according to the table and column definitions).
  • Query can be executed but returns nonsense.

Show Answer

Can this query be executed and is it useful (according to the table and column definitions)? SELECT CTITLE FROM SESSIONS WHERE S_CID = ’7820′

  • Query cannot be executed (gives a syntax error).has
  • Query can be executed and makes sense (according to the table and column definitions).
  • Query can be executed but returns nonsense.

Show Answer

Can this query be executed and is it useful (according to the table and column definitions)?

SELECT ‘CTITLE’ FROM SESSIONS WHERE S_CID = ’7820′

  • Query cannot be executed (gives a syntax error).has
  • Query can be executed and makes sense (according to the table and column definitions).
  • Query can be executed but returns nonsense.

Show Answer

Can this query be executed and is it useful (according to the table and column definitions)?

SELECT SDATE, DISTINCT S_CID FROM SESSIONS ORDER BY S_CID, SDATE

  • Query cannot be executed (gives a syntax error).has
  • Query can be executed and makes sense (according to the table and column definitions).
  • Query can be executed but returns nonsense.

Show Answer

Can this query be executed and is it useful (according to the table and column definitions)?

SELECT SDATE FROM SESSIONS ORDER BY SDATE GROUP BY SDATE

  • Query cannot be executed (gives a syntax error).has
  • Query can be executed and makes sense (according to the table and column definitions).
  • Query can be executed but returns nonsense.

Show Answer

Can this query be executed and is it useful (according to the table and column definitions)?

SELECT SNO FROM SESSIONS WHERE SCANCEL NOT = NULL

  • Query cannot be executed (gives a syntax error).has
  • Query can be executed and makes sense (according to the table and column definitions).
  • Query can be executed but returns nonsense.

Show Answer

Which question corresponds best to the following query?

SELECT * FROM COURSES WHERE CTITLE LIKE ‘%SQL%’ AND CID NOT IN (’7800′,’7820′)

  • Give the first row from the course table for which the column CTITLE equals %SQL% and for which the value in the column CID is neither 7800, nor 7820.
  • Give all rows from the course table for which the column CTITLE equals %SQL% and for
  • which the value in the column CID is neither 7800, nor 7820.
  • Give the first row from the course table for which the column CTITLE contains the character
  • sequence SQL and for which the value in the column CID is neither 7800, nor 7820.
  • Give all rows from the course table for which the column CTITLE contains the character sequence SQL and for which the value in the column CID is neither 7800, nor 7820.

Show Answer

Which question corresponds best to the following query?

SELECT CID, CDUR – 1,’ = PRICE’ FROM COURSES ORDER BY 2

  • Select three columns from the COURSES table, of which the third one has a constant
  • value, i.e. “ = PRICE”. Leave an empty line after every second line.
  • Select two columns from the COURSES table, the second one gets as title “ = PRICE”. Sort the data according to the second column, in ascending order.
  • Select three columns from the COURSES table, of which the third one has a constant value, i.e. “ = PRICE”. Sort the data according to the second column, in ascending order.
  • Select two columns from the COURSES table, of which the second one has a constant value, i.e. “ = PRICE”. Sort the data according to the second column, in ascending order.

Show Answer

Which table will be the result of the query?

SELECT S_CID, MAX(SNO) FROM SESSIONS GROUP BY S_CID ORDER BY 2

  • S_CID MAX(SNO)
    7890
    8000
    7910
    8500
    9000
  • S_CID MAX(SNO)
    7890
    7910
    8000
    8500
    9000
  • S_CID MAX(SNO)
    7890
    7910
  • S_CID MAX(SNO)
    7890
    7910

Show Answer

Give an equivalent for WHERE S_CID BETWEEN ’7000′ AND ’8000′

  • WHERE S_CID >= ’7000′ AND S_CID < = '8000'
  • WHERE S_CID >= ’7000′ AND S_CID < '8000
  • WHERE S_CID > ’7000′ AND S_CID < = '8000'
  • WHERE S_CID > ’7000′ AND S_CID < '8000'

Show Answer