Skip to content
Question
Q.

(a) Consider the given table and write the following queries in MySQL :

Table : Sports

SidSNameFeesDateofPlayCoachId
1Karate12002024-08-24S1
2Football18002024-09-13S2
3Cricket15002024-06-14S3
4Lawn Tennis25002024-09-25S4
5Badminton18002024-10-20S5

(i) To display Sid and name of those sports which are to be played in the month of September. (ii) To display all Sports names in lower case. (iii) To display last two characters of all sports names whose fees is less than 1500. OR (b) Predict the output of the following queries based on the table Sports given above : (i) SELECT UCASE(TRIM(SName)) FROM Sports WHERE Sid=5; (ii) SELECT LEFT (SName,3) FROM Sports WHERE DateofPlay>“2024-09-13”; (iii) SELECT SUBSTR (CoachId,1) FROM Sports WHERE SName=“Cricket” or Fees>=2000;

CBSECBSE Class XII Board 2024Subjective· 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): write MySQL queries using MONTH(), LCASE(), and RIGHT() with WHERE filters. Part (b): predict outputs — (i) BADMINTON, (ii) Law/Bad, (iii) S3/S4.

The Sports table:

SidSNameFeesDateofPlayCoachId
1Karate12002024-08-24S1
2Football18002024-09-13S2
3Cricket15002024-06-14S3
4Lawn Tennis25002024-09-25S4
5Badminton18002024-10-20S5

Part (a)

(i) To pick September rows, extract the month of DateofPlay with MONTH() and compare to 9.

SELECT Sid, SName FROM Sports WHERE MONTH(DateofPlay) = 9;

Expected output:

2  Football
4  Lawn Tennis

(ii) LCASE() (same as LOWER()) converts text to lowercase.

SELECT LCASE(SName) FROM Sports;

Expected output:

karate
football
cricket
lawn tennis
badminton

(iii) RIGHT(str, n) returns the last n characters. Filter Fees < 1500 keeps only Karate (1200).

SELECT RIGHT(SName, 2) FROM Sports WHERE Fees < 1500;

Expected output:

te …

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.