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.
Parameterizing SELECT statements
From the course: Advanced SQL for Application Development
Parameterizing SELECT statements
- [Instructor] Now I'm going to pick up where I left off in the previous video. Now one thing I'm going to do is, I want to remove that global variable called cursor that I just created, so I'll just delete it. And I'm going to do that because I'm going to create a local variable called cursor. Now that wouldn't conflict, but I want to avoid any potential confusion. So one of the things I would like to do, is I want to be able to execute a query. And I want to be able to parameterize that query. So let's take a look at how we do that. And the task we're going to do is to create a query that returns a list of all products of a particular type. Now as you may recall from our discussion of the data model, in our products table, we have a product ID attribute, a product name, and a product type. And we use product type for grouping things together. So let's take advantage of having that type information. Now, the first thing…
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)
-
-
-
-
-
-