Computer Science, asked by TransitionState, 10 months ago

Evaluate these two sql statements: 1. Select concat(first_name, last_name), length(concat(first_name, last_name)) from employee where upper(last_name) like '%j' or upper(last_name) like '%k' or upper(last_name) like '%l'; 2. Select initcap(first_name) || initcap(last_name), length(last_name) + length(first_name) from employee where initcap(substr(last_name, 1, 1)) in ('j', 'k', 'l'); how will the results differ

Answers

Answered by indiabrainly
12

Answer:

Explanation:

"The results for two SQL statements are as follows:

1. Select con cat (first_name, last_name), length(concat(first_name, last_name)) from employee where upper(last_name) like '%j' or upper(last_name) like '%k' or upper(last_name) like '%l';

Ans: This SQL statement will work on the data given in the database. The term con cat will merge or join the first and last name together and the length will calculate the total length of the concatenated word from the records that are present in the table employee in the database. Here the records will be filtered on the basis of last name where it will look for the upper case of the last name that ends with letter ‘j’ but can have any letter before ‘j’ ‘or’ it will look for the upper case of the last name that ends with letter ‘k’ but can have any letter before ‘k’ ‘or’ it will look for the upper case of the last name that ends with letter ‘l’ but can have any letter before ‘l’. Thus output will be provided on the basis of this logic.

2. Select init cap(first_name) || init cap(last_name), length(last_name) + length(first_name) from employee where init cap (substr(last_name, 1, 1)) in ('j', 'k', 'l'); how will the results differ

Ans: This SQL statement will work on the data given in the database. The term init cap will make the first letter of first name capital rest all letters will be small and will concatenate with last name where again term init cap will make the first letter of last name capital rest all letters will be small. The length of the first and last name will be calculated individually and then it will be added. All the data will be fetched from the table employee present in the database where the records are filtered on the basis of sub string operation only the very first letter of the last name will be in capital and records will be filtered where the last name ends with j or k or l.

The results will differ for both 1 and 2 in the database.

"

Similar questions
Math, 5 months ago