Database-MySQL [3i Infotech Placement]: Sample Questions 108 - 109 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 108

Edit

Write in Short

Short Answer▾

What will be the output of the following query?

SELECT DECODE (TRANSLATE ( ‘A’ ‘0’ ‘1’ ) , ‘1’ ‘YES’ ‘NO’ ) .

Explanation

  • Output is “NO” .
  • Translate function first sees whether there is any numeric character in the string.
  • Since there is no numeric character translate would return nothing so when the decode function gets the result of the translate function it just searches for ‘1’ from the result as the result is nothing it would return ‘NO’ .

Question 109

Edit

Describe in Detail

Essay▾

What are partial, alternate, artificial, compound and natural key?

Explanation

Partial key:

  • It is a set of attributes that can uniquely identify weak entities related to same owner entity. It is sometime called as Discriminator.

    Alternate key:

  • All Candidate Keys excluding the Primary Key are known as Alternate Keys.

Artificial key:

  • If no obvious key, either stand-alone or compound is available, then the last resort is to simply create a key, by assigning a unique number to each record or occurrence. Then this is known as developing an artificial key.

Compound Key:

  • If no single data element uniquely identifies occurrences within a construct, then combining multiple elements to create a unique identifier for the construct is known as creating a compound key.

Natural Key:

  • When one of the data elements stored within a construct is utilized as the primary key, then it is called the natural key.

Developed by: