Next up, an exercise using most of the string functions we've learned.
Not all of them.
Treat this as an open book thing.
If you need to go open the docs.
Do it.
I have to look at the docs all the time before I teach any of these videos.
So here we go.
String functions.
There's a couple of pieces to this.
I'm basically going to start with the easiest ones going up to more complicated ones.
The first thing is just to simply reverse and uppercase the following sentence using a single query.
So no tables, no data, just this string.
Then I'd like you to pause for all of these.
But for this one pause and think out loud.
Well, it doesn't have to be out loud, but think to yourself what this evaluates to what is printed
out.
Then I'd like you to write a query using our books.
So if you deleted books, if you got rid of them, just make sure there's some of the books data in
that table.
You don't need all of them.
And I'd like for you to select the titles and replace all spaces with an arrow, which is just a dash
and a greater than sign.
Make sure as well that you name the column that is generated title.
So multiple pieces there.
Next up, I'd like you to print this table out, which is the last name of every author on the left
side, printed forwards and then the same last name in reverse on the right side.
And notice again that we've alias them.
So this one is called forwards and this one is backwards.
Similar story here.
Printouts or generate this table.
This column here is called full name in caps, so make sure you name it that.
And that's exactly what it is.
It is the first name of an author and the last name of an author with a space in the middle.
All capitalized.
All righty.
After that.
This one is called Blurb.
It's the novel blurb.
Or the book blurb.
You'll take the title of each book, the release year of each book, and combine them into a sentence.
So you'll have to put some text before The Namesake.
That's the title.
So actually, you don't put in text before.
Norse mythology is the title.
American Gods and then was released in and then the year it was released.
And then I think we just have to more print the book titles and the length of each book title.
So title and then call this column character count, and we'll have things like American Gods with the
Count of Characters, which is 13, and this is the length and characters, not bytes.
And then the final piece, the most complicated one, is to generate this output.
We have three different fields, three different columns I want you to print out.
The first one is called Short title.
It's the first ten characters, I believe.
One, two, three, four, five, six, seven, eight, nine, ten of a book title of all book titles
plus dot, dot, dot at the end.
And then we have author, which is every author's last name and then a comma, and then their first
name.
And then we have quantity, which is the number in stock.
That's one of the fields on our table.
If we do describe books, one of the columns is called Stock Quantity.
So I want that stock quantity.
But in stock as a sentence or as a I guess it's a fragment.
I don't know why we would want that, but just do it.
It's a last piece of the exercise.
So there's a lot of pieces to this one.
Go through this and pause with this video and try and figure out the correct code to generate the output
that you see on each slide.
But first, we have the simpler ones.
So in the next video, we'll have a solution, but I hope you try it.
Please do it.