Jeffrey Lueken
Jeffrey Lueken

Reputation: 61

postgreSQL LEFT and UPPER interaction

Question: Write a query that returns the name, address, state, and zipcode from all purchases. For the names, return only the first 5 characters, and display them in all uppercase letters, sorted in alphabetical order.

Code so far:

SELECT LEFT (name, 5) AS UPPER, address, state, zipcode
FROM purchases
ORDER BY name;

I'm at a loss of where and how to use UPPER to capitalize all the characters in the first column that is being returned. So far this is 9/10 checks passed for my code.

Upvotes: 1

Views: 416

Answers (1)

Omari Victor Omosa
Omari Victor Omosa

Reputation: 2879

Add upper function in your query

SELECT UPPER(LEFT('JOhNdOEISMYNAME', 5)) AS UPPER

Upvotes: 2

Related Questions