Informatics Practices

Write the SQL queries which will perform the following operations :

(i) To display the year from your Date of Admission which is '2023-05-15'.

(ii) To convert your email id 'ABC@XYZ.com' to lowercase.

(iii) To remove leading spaces from a string 'my country'.

(iv) To display current date.

(v) To display the value of 106.

SQL Queries

2 Likes

Answer

(i)

SELECT YEAR('2023-05-15');
Output
+--------------------+
| YEAR('2023-05-15') |
+--------------------+
|               2023 |
+--------------------+

(ii)

SELECT LCASE('ABC@XYZ.com');
Output
+----------------------+
| LCASE('ABC@XYZ.com') |
+----------------------+
| abc@xyz.com          |
+----------------------+

(iii)

SELECT LTRIM('    my country');
Output
+---------------------+
| LTRIM('my country') |
+---------------------+
| my country          |
+---------------------+

(iv)

SELECT CURDATE();
Output
+------------+
| CURDATE()  |
+------------+
| 2024-05-21 |
+------------+

(v)

SELECT POWER(10, 6);
Output
+--------------+
| POWER(10, 6) |
+--------------+
|      1000000 |
+--------------+

Answered By

1 Like


Related Questions