Help SQL Guided Project: Designing and Creating a Database

Screen Link: https://app.dataquest.io/m/193/guided-project%3A-designing-and-creating-a-database/8/adding-the-person-appearance-table

Your Code: ```
SELECT
game_id,
{hv}_name,
{hv}player{num}_id,
“D” || CAST({hv}player{num}_def_pos AS INT)
FROM game_log
WHERE {hv}player{num}_id IS NOT NULL;
“”"

run_command(c1)
run_command(c2)

for hv in [“h”,“v”]:
for num in range(1,10):
query_vars = {
“hv”: hv,
“num”: num
}
run_command(template.format(**query_vars)) ‘’’

Other details: Pls, someone explain for me why we need use ** before query_vars in the last code line ?

Best answer which explains this in great details is here.

In short, the *args and **kwargs is a common idiom to allow arbitrary number of arguments to functions.

1 Like