1
00:00:00,120 --> 00:00:04,550
Next up, we've got two very simple string functions upper and lower.

2
00:00:04,560 --> 00:00:10,710
They help us change the casing of a string so upper will make a string uppercase instead of Hello world,

3
00:00:10,710 --> 00:00:11,910
we get Hello world.

4
00:00:11,910 --> 00:00:16,079
And instead of I don't know how you would say this out loud.

5
00:00:16,079 --> 00:00:21,090
Hello world, we get Hello world lowercase, right?

6
00:00:21,120 --> 00:00:23,160
It's just upper versus lower.

7
00:00:23,250 --> 00:00:25,080
That's really all that there is.

8
00:00:25,350 --> 00:00:36,390
There are a couple of aliases or shorter versions, so upper is also callable as you case and lower

9
00:00:36,540 --> 00:00:41,370
is callable as they show this somewhere on here L case.

10
00:00:41,370 --> 00:00:43,260
So I'll prove that real quick.

11
00:00:43,710 --> 00:00:46,140
Let's do select upper.

12
00:00:47,410 --> 00:00:48,220
Hello.

13
00:00:49,820 --> 00:00:50,520
And we get.

14
00:00:50,540 --> 00:00:51,290
Hello.

15
00:00:52,340 --> 00:00:54,170
If I do, you case.

16
00:00:55,490 --> 00:00:56,730
I get the same result.

17
00:00:56,750 --> 00:01:04,580
Now, if I have some uppercase string or some upper and lowercase string like that and I do lower,

18
00:01:05,180 --> 00:01:07,520
the whole thing is lowercase and same thing.

19
00:01:07,520 --> 00:01:08,120
No surprise.

20
00:01:08,120 --> 00:01:12,110
Hopefully if I do LX case, we get the lowercase version.

21
00:01:12,110 --> 00:01:12,980
Same thing.

22
00:01:13,490 --> 00:01:17,120
So why don't we try a simple example, but select?

23
00:01:17,270 --> 00:01:19,340
Let's see, what are the columns we have?

24
00:01:19,460 --> 00:01:23,510
Let's do select star from books.

25
00:01:24,340 --> 00:01:27,640
And let's take the book title.

26
00:01:27,850 --> 00:01:35,620
So select and let's uppercase the title upper title from books.

27
00:01:36,280 --> 00:01:37,330
And there we are.

28
00:01:37,660 --> 00:01:40,750
Now, here's a quick little bonus exercise.

29
00:01:40,750 --> 00:01:47,560
I want you and I'll do it as well to write a query that generates a column where the results look like

30
00:01:47,560 --> 00:01:47,920
this.

31
00:01:47,950 --> 00:01:49,060
I'll just type it out here.

32
00:01:49,060 --> 00:01:53,080
I want it to look like I love the namesake.

33
00:01:53,080 --> 00:01:55,840
Exclamation point, exclamation point, exclamation point.

34
00:01:56,350 --> 00:02:03,550
So I want you to take the word I love and space and always put it in front of the uppercase title and

35
00:02:03,550 --> 00:02:07,000
then at the end do a space with more exclamation points.

36
00:02:07,000 --> 00:02:08,949
So let's try writing that query.

37
00:02:09,580 --> 00:02:11,110
I'll just do it over here for now.

38
00:02:11,110 --> 00:02:13,090
In Workbench.

39
00:02:13,090 --> 00:02:15,490
I keep getting confused between these, but it doesn't matter.

40
00:02:15,500 --> 00:02:16,780
We've got different options.

41
00:02:16,780 --> 00:02:17,860
SQL doesn't matter.

42
00:02:17,860 --> 00:02:19,210
It doesn't care where you write it.

43
00:02:19,300 --> 00:02:24,670
So select and I'm going to concatenate what am I concatenating?

44
00:02:24,820 --> 00:02:29,890
I'm going to start with I love into space and let me use single quotes because I've been harping on

45
00:02:29,890 --> 00:02:35,440
how that's important, or at least a good practice, even if I break that rule subconsciously, because

46
00:02:35,440 --> 00:02:38,410
every other programming language I write wants you to use double quotes.

47
00:02:38,710 --> 00:02:40,000
So I apologize for that.

48
00:02:40,000 --> 00:02:42,040
Anyway, you can cut, I love.

49
00:02:42,040 --> 00:02:48,850
And then instead of just the title, we want upper title, and then after that we want a space.

50
00:02:48,850 --> 00:02:50,350
Three exclamation points.

51
00:02:51,610 --> 00:02:53,510
And this one's simple enough on a single line.

52
00:02:53,530 --> 00:02:54,820
Let's see if it works.

53
00:02:55,890 --> 00:02:56,360
Unknown.

54
00:02:56,430 --> 00:02:57,180
Oh, my gosh.

55
00:02:57,180 --> 00:02:59,580
How am I forgetting from books?

56
00:03:00,180 --> 00:03:02,280
It's the only mistake we have to say where it's coming from.

57
00:03:02,310 --> 00:03:04,140
Of course, what we're selecting from.

58
00:03:04,140 --> 00:03:05,010
And now we get.

59
00:03:05,010 --> 00:03:06,170
I love the namesake.

60
00:03:06,180 --> 00:03:10,890
I love Norse mythology, I love white noise, I love considered the lobster and so on.

61
00:03:11,220 --> 00:03:11,580
All right.

62
00:03:11,580 --> 00:03:16,220
So just a little more practice combining these operations, combining these string functions together.

63
00:03:16,230 --> 00:03:18,570
I know it's all stupid right now.

64
00:03:18,600 --> 00:03:25,380
These are silly things, but eventually we're going to learn how to do things like find the maximum

65
00:03:25,380 --> 00:03:33,240
of a list of values so we could find the longest book in here in terms of pages or in terms of character

66
00:03:33,240 --> 00:03:34,590
length in the title.

67
00:03:34,590 --> 00:03:35,880
But we've got to start somewhere.

68
00:03:35,880 --> 00:03:40,890
This is our first little bit of adding on to basic selections.

69
00:03:40,890 --> 00:03:45,600
We can manipulate the results using these string functions, even if they're very basic and they don't

70
00:03:45,600 --> 00:03:48,270
seem that useful, they are very important to know.

