Write a query to fetch the names of the students in upper case

Description: Show every student name in capital letters.

Tables: the exercises use the students (id, name, city, marks, course_id) and courses (id, course_name) tables, with the data from our MySQL INSERT chapter. The students are: Robin (Delhi, 85), Maria (Mumbai, 92), John (Pune, 78), Asha (Jaipur, 88), Vikram (Delhi, 65), Neha (Mumbai, 45).

Hint:

  • Use the UPPER() function.
  • Give the result a name with AS.

MySQL query for upper case names

SELECT UPPER(name) AS name_upper
FROM students;

Output:

Tutorials Class - Output Window
name_upper
ROBIN
MARIA
JOHN
ASHA
VIKRAM
NEHA

How it works

  • UPPER() changes the text to capital letters in the result only. The stored data is not changed.
  • LOWER() does the opposite.

Read String Functions.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.