KnowledgeBoat Logo
|
LoginJOIN NOW

Informatics Practices

Write suitable SQL queries for the following :

(i) To calculate the exponent for 3 raised to the power of 4.

(ii) To display current date and time.

(iii) To round off the value -34.4567 to 2 decimal place.

(iv) To remove all the probable leading and trailing spaces from the column userid of the table named user.

(v) To display the length of the string ‘FIFA World Cup’.

SQL Queries

1 Like

Answer

(i)

SELECT POWER(3, 4);
Output
+-------------+
| POWER(3, 4) |
+-------------+
|          81 |
+-------------+

(ii)

SELECT NOW();
Output
+---------------------+
| NOW()               |
+---------------------+
| 2024-05-21 12:20:03 |
+---------------------+

(iii)

SELECT ROUND(-34.4567, 2);
Output
+--------------------+
| ROUND(-34.4567, 2) |
+--------------------+
|             -34.46 |
+--------------------+

(iv)

UPDATE user
SET userid = TRIM(userid);

(v)

SELECT LENGTH("FIFA World Cup");
Output
+--------------------------+
| LENGTH("FIFA WORLD CUP") |
+--------------------------+
|                       14 |
+--------------------------+

Answered By

2 Likes


Related Questions