Database-MySQL [3i Infotech Placement]: Sample Questions 17 - 19 of 162

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 17

Edit

Describe in Detail

Essay▾

Why does the following command give a compilation error?

DROP TABLE &TABLE_NAME.

Explanation

  • Variable name starts with an alphabet.
  • The table name cannot starts with an ‘&’ symbol.

DROP TABLE:

  • Drop table statement is used to drop an existing table in database.

Syntax:

DROP TABLE table_name;

Parameters:

table_name

  • Table name is removed from the database.

Question 18

Edit

Describe in Detail

Essay▾

Which function is used to find the largest integer less than or equal to a specific value?

Explanation

  • FLOOR function is used to find the largest integer less than or equal to a specific value.
  • Used to round a number down to the last whole number.
  • The highest decimal is rounded down with any number.

Syntax:

FLOOR (numeric_expression)

Arguments:

numeric_expression:

  • It is an expression of the exact number or approximate numeric data type category, except for the bit data type.

Example:

SELECT FLOOR (-5.12) ;

This will round down to -6

SELECT FLOOR (5.14) ;

This will round down to 5

Question 19

Edit

Statement

True-False▾

EXISTS, SOME, ANY are operators in SQL.

Answer

TRUE

Explanation

EXISTS operator:

  • Used to test for the existence of any record in a subquery.
  • Returns true if subquery returns one or more record.

Syntax:

SELECT column_name (s)

FROM table_name

WHERE EXISTS

(SELECT column_name FROM table_name WHERE condition) ;

SOME operator:

  • Compares a value to every other value in list or results from query.
  • It evaluates to true if the result of an inner query contains at least one row.

Syntax:

SELECT [column_name … . | expression1}

FROM [table_name]

Where expression2 comparison_operator {ALL|ANY|SOME} (subquery)

ANY operator:

  • ANY compares a value to every value in list or result from a query
  • It evaluates to true if the result of an inner query contains at least one row.
  • It is preceded by comparison operators.
  • Using greater (>) with ANY ensures result greater than at least one value.

Syntax:

SELECT [column_name … | expression1|

FROM [table_name]

WHERE expression2 comparison_operator {ALL|ANY|SOME} (subquery)

Developed by: