Skip to content
Question
Q.

Predict the output of the following SQL queries :

  1. SELECT TRIM(“ ALL THE BEST ”) ;
  2. SELECT POWER(5,2);
  3. SELECT UPPER(MID(“start up india”,10)); OR Consider a table “MYPET” with the following data : Table : MYPET
Pet_idPet_NameBreedLifeSpanPriceDiscount
101RockyLabrador Retriever12160005
202DukeGerman Shepherd132200010
303OliverBulldog10180007
404CooperYorkshire Terrier162000012
505OscarShih TzuNULL250008

Write SQL queries for the following :

  1. Display the Breed of all the pets in uppercase.
  2. Display the total price of all the pets.
  3. Display the average life span of all the pets.
CBSECBSE Class XII Board 2022Subjective· 3mImportance★★★★★
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

Part (a): TRIM(" ALL THE BEST ") = ALL THE BEST, POWER(5,2) = 25, UPPER(MID("start up india",10)) = INDIA.

Part (b): use UPPER(Breed), SUM(Price)=101000, and AVG(LifeSpan)=12.75 (NULL ignored).

Part (a)

(i) SELECT TRIM(" ALL THE BEST "); — TRIM() strips leading and trailing spaces from a string.

ALL THE BEST

(ii) SELECT POWER(5,2); — POWER(base, exp) returns base raised to exp, so 5² .

25

(iii) SELECT UPPER(MID("start up india",10)); — evaluate the inner function first. Counting from 1, the 10th character of start up india is i; with no length given MID takes everything to the end → india. UPPER() then makes it uppercase.

INDIA …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.