You are working with a Person database table that stores information about various professionals. Your task is to create a formatted report that displays each person's name followed by the first letter of their profession in parentheses.
Table Schema:
Person
+-------------+---------+
| Column Name | Type |
+-------------+---------+
| person_id | int |
| name | varchar |
| profession | ENUM |
+-------------+---------+
The profession column contains one of these values: 'Doctor', 'Singer', 'Actor', 'Player', 'Engineer', or 'Lawyer'
Your Goal: Write a SQL query that returns each person's name concatenated with the first letter of their profession enclosed in parentheses. The results should be ordered by person_id in descending order.
Example: If someone is named "John" and their profession is "Doctor", the output should be "John(D)".
Input & Output
Visualization
Time & Space Complexity
Linear scan through all rows in the table
No additional space needed beyond result set
Constraints
- 1 โค person_id โค 1000
- name contains only English letters and spaces
- profession is one of: 'Doctor', 'Singer', 'Actor', 'Player', 'Engineer', 'Lawyer'
- Results must be ordered by person_id DESC