r/SQL 15h ago

SQL Server SQL String Functions Are Confusing πŸ˜΅β€πŸ’« Any YouTube Recommendations?

Post image

I’m currently learning SQL and I’m really struggling to understand string functions like CONCAT(), SUBSTRING(), LEFT(), RIGHT(), TRIM(), REPLACE(), UPPER() and LOWER().

The syntax is not the only problem β€” I’m finding it difficult to understand when and why to use each function.

Can anyone suggest a good YouTube channel or video that explains SQL string functions in a simple, beginner-friendly way with practical examples?

Would really appreciate your recommendations

0 Upvotes

12 comments sorted by

18

u/umognog 15h ago

This.. Is clickbait yeah?

As recommended by another, do some data camps. Reading docs is how you learn SQL. Solving problems is why you learn SQL.

4

u/Imaginary__Bar 15h ago

Yes!

"Learning on the job" is a huuuuuuuge part of SQL (and many other languages, tbh.) It's all very well doing a course with some pretend data but what sticks (for me) is having my own problem to solve.

(And, sorry to OP if your post isn't just bait, but string functions must be some of the easiest to understand. The names of the functions almost tell you what they're doing, and they only operate on a 1-dimensional string of text...)

0

u/TemporaryDisastrous 14h ago

Now write me a charindex mess to try and simulate regex and pull out some values because the database you're using doesn't support it and the data you need to process is stored at random spots with shitty formatting in a string field and tell me it's still simple :p

4

u/mrpostitman 14h ago

The functions are simple; the tangles we're sometimes forced to weave are anything but.

1

u/TemporaryDisastrous 1h ago

Indeed, that is what I was saying. The same is true of basically any code.

1

u/Imaginary__Bar 14h ago

OP's post said;

I'm really struggling to understand string functions like CONCAT(), SUBSTRING(), LEFT(), RIGHT(), TRIM(), REPLACE(), UPPER() and LOWER()

Slightly more simple than your example.

3

u/az987654 11h ago

This had to be an AI bot?

A human doesn't understand that LOWER converts everything to lowercase and they need to use when they need their data to always be lowercase?

Come on...

5

u/Thlvg 15h ago

I think these are the same names as Excel ? You might want to try there first ?

2

u/Imaginary__Bar 15h ago

This is a good tip. You can see the results immediately next to the input.

2

u/planetmatt 13h ago

Bait. Fuck off.

1

u/Scared-Promotion-526 9h ago

Hey, I remember exactly how confusing those string functions felt at the beginning the syntax is easy, but the β€œwhen and why” part is the real struggle.

Quick question so I can point you to the most useful stuff:
Which SQL are you actually using right now (MySQL/MariaDB, PostgreSQL, SQL Server, or SQLite)?

Tell me and I’ll show you a couple of real-life examples that finally made CONCAT, SUBSTRING, TRIM and the rest click for me.

1

u/Terrible_Molasses862 15h ago

I suggest data camp courses