Current section: SQL 6 exercises

SQL Queries for User Search in Prisma


00:00 we still have one more place where we're still using the in-memory database instead of the actual database, and that's our user search page. So that is your job. You need to add the SQL query that is going to search users. This is going to be a little bit more complicated because you

00:17 can just use regular Prisma to query the way that we're doing. But our product manager has a couple of interesting requirements that they want us to do. So we're going to actually write raw SQL in this exercise. So it's going to be a little bit, if you haven't done any SQL before,

00:35 but Prisma has a really great way to execute a query safely, so you don't have to worry about escaping things, and it has this $query raw thing and it's a tag template, literally just like insert stuff and it'll escape it. It's awesome. So that's what you're going to be doing in this exercise. We've got a couple of steps to

00:52 iterate to the final solution that our product manager wants us to have. But for this first step, we're just going to do a basic search so that when you search for Cody, it shows up Cody. When you are finished, we should actually be able to see multiple users on this page because

01:09 our database that's the actual SQLite database does have multiple users in there. Right now, we're only seeing one because in our in-memory database, we only have one. So get to it. Let's get going.