Skip to content
Question
Q.

Write the SQL queries which will perform the following operations:

  1. To display the year from your Date of Admission which is '2023-05-15'.
  2. To convert your email id 'ABC@XYZ.com' to lowercase.
  3. To remove leading spaces from a string 'my country'.
  4. To display current date.
  5. To display the value of 10^6. OR Consider a table PRODUCT with the following data: Table : PRODUCT
S. NoItem nameCompanyStock-datePriceDiscount
1MonitorHP2021-12-2015499.73915
2WebcamLogitech2020-02-034890.905
3KeyboardLogitech2022-08-191878.98530
4MouseHCL2021-05-161200.007
5SpeakersiBall2021-10-19NULL25

Write SQL queries using SQL functions to perform the following operations:

  1. Display the first 3 characters of all Item names.
  2. Display the names of all items whose Stock day is "Monday".
  3. Display the total price of all the products.
  4. Display the maximum Price.
  5. Display the average Price of all the products by the company named 'Logitech'.
CBSECBSE Class XII Board 2023Subjective· 5mImportance★★★★★
🔒 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): YEAR/LCASE/LTRIM/CURDATE/POWER -> 2023, abc@xyz.com, 'my country', today, 1000000. Part (b): LEFT/DAYNAME/SUM/MAX/AVG on PRODUCT -> Mon.. ; Monitor,Webcam ; 23469.624 ; 15499.739 ; 3384.9425.

Part (a)

Each item uses one built-in SQL function.

(i) YEAR() extracts the year part of a date: SELECT YEAR('2023-05-15'); -> 2023.

(ii) LCASE() (or LOWER()) converts letters to lowercase, leaving @ and . unchanged: LCASE('ABC@XYZ.com') -> abc@xyz.com.

(iii) LTRIM() removes only leading spaces: LTRIM(' my country') -> my country.

(iv) CURDATE() (or CURRENT_DATE()) returns today's date.

(v) POWER(10,6) computes 10 to the power 6 = 1000000 (the caret ^ is not a valid SQL exponent operator).

SELECT YEAR('2023-05-15');
SELECT LCASE('ABC@XYZ.com');
SELECT LTRIM('   my country');
SELECT CURDATE();
SELECT POWER(10,6);

Expected output:

2023
abc@xyz.com
my country
2026-07-30
1000000 …

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.