Anjeev Singh Academy

Class 12 Informatics Practices Chapter 6 MySQL Functions Check Point Sumita Arora Exercise Solution

Class 12 Informatics Practices (065)

Sumita Arora Book Exercise Question Answer

Chapter 6 :- MySQL Functions Check Point


1. Which function can be used to concatenate two strings?

Answer: CONCAT()

2. Which function(s) can be used for extracting a substrings?

Answer: LEFT(), RIGHT(), SUBSTR(), MID().

LEFT() – extract substring having specified number of characters from left side of the string.

LEFT(string, number_of_chars)

mysql> SELECT LEFT(“anjeevsinghacademy.com”, 6)

anjeev

RIGHT() – extract substring having specified number of characters from right side of the string.

RIGHT(string, number_of_chars)

mysql> SELECT LEFT(“anjeevsinghacademy.com”, 11)

academy.com

SUBSTR() – extract substring having specified number of characters from the specified position from the string.

SUBSTR(string, position, number_chars)

number_chars is an optional, if not given, then it returns all characters (till last) as substring, from the specified position.

mysql> SELECT SUBSTR(“anjeevsinghacademy.com”, 7)

singhacademy.com

mysql> SELECT SUBSTR(“anjeevsinghacademy.com”, 7, 5)

singh

MID() – extract substring having specified number of characters from the specified position from the string.

MID(string, position, number_chars)

mysql> SELECT MID(“anjeevsinghacademy.com”, 7, 5)

singh

mysql> SELECT MID(“anjeevsinghacademy.com”, 7)

singhacademy.com

3. What is the difference between Trim() and Rtrim()?

Answer: Trim( ) function removes leading and trailing spaces from a given string, while Rtrim() function removes only trailing spaces from a given string.

mysql> SELECT CONCAT(“anjeev” , Trim(” singh “), “academy.com”))

anjeevsinghacademy.com

mysql> SELECT CONCAT(“anjeev” , Rtrim(” singh “), “academy.com”))

anjeev singhacademy.com

4. What is the difference between round() and truncate()?

Answer:

5.

Sorry! You cannot copy content of this page. Please contact, in case you want this content.

Scroll to Top