Skip to content

Commit 6f46d2a

Browse files
committed
Upload 176
1 parent ec26bba commit 6f46d2a

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- markdownlint-disable MD041 -->
22
[![eevveerryyddaayy release](https://img.shields.io/badge/eevveerryyddaayy-v1.3.0-blue.svg)](https://github.com/ggeerraarrdd/eevveerryyddaayy/)
3-
[![Solved](https://img.shields.io/badge/solved-175-green.svg)](#index)
3+
[![Solved](https://img.shields.io/badge/solved-176-green.svg)](#index)
44
<!-- markdownlint-enable MD041 -->
55

66
# SQL Everyday
@@ -209,6 +209,7 @@ Because this project necessitated a framework to enable consistent daily practic
209209
| 173 | [Customers Who Bought Products A and B but Not C](https://leetcode.com/problems/customers-who-bought-products-a-and-b-but-not-c/description/) | [Solution](solutions/173_customers_who_bought_products_a_and_b_but_not_c.md) | LeetCode | Medium | `STRING_AGG` |
210210
| 174 | [Highest Salaries Difference](https://leetcode.com/problems/highest-salaries-difference/description/) | [Solution](solutions/174_highest_salaries_difference.md) | LeetCode | Easy | |
211211
| 175 | [Form a Chemical Bond](https://leetcode.com/problems/form-a-chemical-bond/description/) | [Solution](solutions/175_form_a_chemical_bond.md) | LeetCode | Easy | `CROSS JOIN` |
212+
| 176 | [Concatenate the Name and the Profession](https://leetcode.com/problems/concatenate-the-name-and-the-profession/description/) | [Solution](solutions/176_concatenate_the_name_and_the_profession.md) | LeetCode | Easy | `SUBSTRING` vs `LEFT` |
212213
<!-- Index End - WARNING: Do not delete or modify this markdown comment. -->
213214
<!--- cSpell:enable --->
214215

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# SQL Everyday \#176
2+
3+
## Concatenate the Name and the Profession
4+
5+
Site: LeetCode\
6+
Difficulty per Site: Easy
7+
8+
## Problem
9+
10+
Write a solution to report each person's name followed by the first letter of their profession enclosed in parentheses.
11+
12+
Return the result table **ordered** by `person_id` in **descending order**. [[Full Description](https://leetcode.com/problems/concatenate-the-name-and-the-profession/description/)]
13+
14+
## Submitted Solution
15+
16+
```sql
17+
-- Submitted Solution
18+
SELECT
19+
person_id
20+
,CONCAT(name, '(', SUBSTRING(profession, 1, 1), ')') AS name
21+
FROM Person
22+
ORDER BY person_id DESC
23+
;
24+
```
25+
26+
## Site Solution
27+
28+
```sql
29+
-- LeetCode Solution
30+
-- Code Author: Mathieu Soysal
31+
-- https://leetcode.com/problems/concatenate-the-name-and-the-profession/solutions/5003721/simple-postgresql-solution-with-concat-and-left
32+
SELECT person_id,
33+
CONCAT(name, '(' , LEFT(profession, 1), ')') AS name
34+
FROM Person
35+
ORDER BY person_id DESC;
36+
```
37+
38+
## Notes
39+
40+
TBD
41+
42+
## NB
43+
44+
`SUBSTRING` vs `LEFT`
45+
46+
Go to [Index](../?tab=readme-ov-file#index)\
47+
Go to [Overview](../?tab=readme-ov-file)

0 commit comments

Comments
 (0)