From the course: Intermediate SQL: Data Reporting and Analysis
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Use string functions - SQL Tutorial
From the course: Intermediate SQL: Data Reporting and Analysis
Use string functions
- [Instructor] String functions a little formally that turn one piece of text into another. They might capitalize the text, locate one string inside another, replace all the spaces with underscores, or act as a VLOOKUP and many, many other things. Each version of SQL has different string functions but some are common across versions. And luckily for us, these are the most useful. The first we're going to look at is substr. Let's look at the category table. It's a simple table with the name field such as Action and Children and so on. And we are going to say, SELECT SUBSTR name,1. And there we get all the names. Now notice that one there meant the start of the word so it's not zero indexed. In some cases you need zero to indicate the start, in this case not. So we've told the database to return part of the text of the name field starting at position one. Now let's change that and take position two. And you can see it's…
Contents
-
-
-
-
The basic SELECT query1m 57s
-
(Locked)
Aggregated results with GROUP BY1m 51s
-
(Locked)
Wildcards and aliases6m
-
(Locked)
Merging tables with JOIN3m 56s
-
(Locked)
Use string functions8m 6s
-
(Locked)
Use number functions with grouped data6m 46s
-
(Locked)
Use date functions6m 7s
-
(Locked)
Challenge: Report average cost by staff53s
-
(Locked)
Solution: Report average cost by staff1m 49s
-
-
-
-
-