All right.
We've learned a lot in this section between all the different operators, the different comparison operators,
logical operators, like and and or not to mention things like case statements which are complicated
but powerful.
It's now your turn to get some practice.
So as always, with these exercises, I'm going to show you the slides, different prompts, different
challenges.
And then in the next video, I'll have a solution.
So this first piece is just to mentally evaluate the following.
Don't actually type this out and run them three different lines that all involve comparisons and some
of these operators like and in or that we've learned in between and all of that.
Okay next up we're back with a books data set select all the books written before 1980 non inclusive
meaning I don't want to include 1980 so up to 1980.
Then write a query to select all the books written by with the last name of the author Eggers or Shaban.
Shaban.
Shaban Shaban Select all the books written by Lahiri that were also published after the year 2000.
And again, I'm talking about last name.
Then select all books that have a page count between 102 hundred.
Select all books where the author's last name starts with a C or an S.
This one's a little more complicated.
So create this result.
We have the title, we have the author's last name, and then we have this type column that says novel
memoir or short stories.
So you'll need to use case.
If the title of the book contains the word stories, then the type should be short stories.
Then if the title this one is kind of lame, I'm asking you to literally match the title of Just Kids.
That's one of the books by Patti Smith and also a heartbreaking work of staggering genius.
It's a long one to type out.
It is not called a heartbreaking, heartbreaking work.
It is a heartbreaking work of staggering genius.
I just couldn't fit it in here.
So it's kind of lame because I'm asking you to, like, literally match two titles and call them memoirs,
which is fine.
It's just an exercise.
And then everything else that was not a memoir or a short story, just classify as novel.
All right.
And then we have this final bonus, which involves some other stuff we learned in previous sections
that we haven't revisited in this section.
I don't want to say too much, but I'd like you to generate this output where we have the author's first
name and last name, and then for each grouping of first name and last name, I want to see how many
books they wrote.
So Jhumpa Lahiri We see two books, Neil Gaiman three books.
But what's a little bit fancy here is we don't even just see the number, but we see the word books
afterwards or the singular of book.
Dan Harris has one book.
George Saunders has one book in our dataset, so you'll need to make some sort of decision based off
of how many books there are.
Then generate this output that uses books or book depending on if we're working with a single book or
multiple.
So it's a bonus.
Go ahead and try that if you'd like, and I'll be back in the next video with a solution.
All right.
See you then.