Prepared Statements
Build on the fundamentals of user-defined variables by learning about prepared statements.
We'll cover the following...
With our running example, we have put into practice our knowledge of user-defined variables in MySQL and how they support us in accessing repeatedly used values. Meanwhile, we have iteratively built a database that records car models and the assembly of their parts:
Recording car models in CarModel or their assembled parts in CarPart requires us to repeatedly use the same SQL statements over time, e.g., INSERT INTO. However, only the values used within these statements vary like the different names of car models or their parts:
With our knowledge of other programming languages like C++, Python, or JavaScript, we already have a feeling about how we should proceed in a situation like this. Typically, we would extract duplicated code into functions or ...