CBSE Class 12 Informatics Practices
Question 70 of 81
MySQL Functions — Question 21
Back to all questions 21
Question Write suitable SQL query for the following :
(i) Display 7 characters extracted from 7th left character onwards from the string 'INDIA SHINING'.
(ii) Display the position of occurrence of string 'COME' in the string 'WELCOME WORLD'.
(iii) Round off the value 23.78 to one decimal place.
(iv) Display the remainder of 100 divided by 9.
(v) Remove all the expected leading and trailing spaces from a column userid of the table 'USERS'.
(i)
SELECT SUBSTR('INDIA SHINING', 7, 7);+-------------------------------+
| SUBSTR('INDIA SHINING', 7, 7) |
+-------------------------------+
| SHINING |
+-------------------------------+
(ii)
SELECT INSTR('WELCOME WORLD', 'COME');+--------------------------------+
| INSTR('WELCOME WORLD', 'COME') |
+--------------------------------+
| 4 |
+--------------------------------+
(iii)
SELECT ROUND(23.78, 1);+-----------------+
| ROUND(23.78, 1) |
+-----------------+
| 23.8 |
+-----------------+
(iv)
SELECT MOD(100, 9);+-------------+
| MOD(100, 9) |
+-------------+
| 1 |
+-------------+
(v)
SELECT TRIM(userid) FROM USERS;