From the course: Advanced SQL for Application Development
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Solution: How to write a parameterized query in Python
From the course: Advanced SQL for Application Development
Solution: How to write a parameterized query in Python
(bright upbeat music) - [Instructor] Let's take a look at the solution to the challenge. Here, I've created a function called, get product orders by type two. Now this looks similar to the get product orders by type that we created earlier. But I want to point out a difference. Here in the sequel string, we have our select and we're selecting start from our product order. We're using an inner join, remember we don't want to do than N+ 1 query and we still have the same on clause because the keys in product order and product are the same, the only difference is, is that we add another condition. We say and product order or PO.quantity is greater than three. So let's execute this, let's define that and let's actually execute it. So we'll say, get product orders and one nice thing about Jupiter if you hit tab, it'll give you the Command complete and I'm going to say order by two, I'm not going to pass in our…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
(Locked)
Designing an ecommerce application database6m 5s
-
(Locked)
Creating tables and loading data4m 12s
-
(Locked)
Using environment variables for connection parameters3m 57s
-
Connecting to a database2m 28s
-
(Locked)
Parameterizing SELECT statements3m 37s
-
(Locked)
Avoiding N+1 queries7m 18s
-
(Locked)
Challenge: Write a parameterized query in Python43s
-
(Locked)
Solution: How to write a parameterized query in Python2m 21s
-
(Locked)
-
-
-
-
-
-