1. Write the output of the following SQL command: (i) selectconcat(Lcase(\'To be
ID: 3705832 • Letter: 1
Question
1. Write the output of the following SQL command:
(i) selectconcat(Lcase('To be'),trtm(traillng '.' From 'continued ... '));
(ii) select round(15.193,1) + truncate(2.24,1);
(iii) selectlen(trim('Ajay#Jain###')) (# means blank space)
(iv) select mid(trim('#lnformatics Practices##'),6,6); (# means blank space)
2. There is a table Tl with combination of columns Cl, C2, and C3 as its primary key? Is it possible to enter:
a. NULL values in any of these columns?
b. Duplicate values in any of these columns?
Explanation / Answer
i. select concat(Lcase('To be'),trim(traillng '.' From 'continued ... '));
Lcase('To be') converts upper case to lower case characters. i.e. to be
trim(traillng '.' From 'continued ... ') removes trailing '.' from 'continued ...' i.e. output is continued
concat concatenates two strings
Output:
to becontinued
ii. select round(15.193,1) + truncate(2.24,1);
round(15.193,1) rounds up to 1 decimal place i.e. number becomes 15.2
truncate(2.24,1) truncates a number to specified number of decimal places
15.2 + 2.2 = 17.4
Output:
17.4
iii. selectlen(trim('Ajay#Jain###')) (# means blank space)
trim function removes leading and trailing spaces from given string.
len function compute length of string
So, output will be :
9
as length of Ajay Jain is 9
iv. select mid(trim('#lnformatics Practices##'),6,6);
trim('#lnformatics Practices##') returns Informatics Practices
mid(string, start,length) returns string starting from position start and returning length number of characters.
mid('Information Practices',6,6) returns 'matics'
Output
matics
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.