Manipulating Functions

Hi. I've been asked to create a list of all the contact people where the first 4 characters of their last name are equal to the first 4 characters of their email address. Second find all the contact people whose first name and the last name begin with the same character, create a new column called full name combining their first name and their last name. Finally, add a column with the length of the full name. I'm really struggling with this. and have only done the below.

SELECT
[FirstName],[LastName],[EmailAddress],LEFT([LastName],4) First4Characters,
CONCAT(Firstname,' ', Lastname) AS FullName

FROM [Person].[Person] PP
INNER JOIN [Person].[EmailAddress] PEA
ON PP.[BusinessEntityID]=PEA.[BusinessEntityID]
WHERE [EmailAddress] LIKE'First4Characters%'

Sounds like homework. Can DDL, Sample Data and a query or 2 that you have tried, we can provide a better solution

1 Like