
Answer-first summary for fast verification
Answer: table_name = 'sales' schema_name = 'bronze' query = f'select * from { schema_name}.{table_name}'
The correct answer uses an f-string to dynamically insert the schema and table names into the query. F-strings in Python allow for the embedding of expressions inside string literals, using curly braces `{}`. The syntax `f'select * from {schema_name}.{table_name}'` correctly formats the string with the variable values. For more details on f-strings, visit [Real Python](https://realpython.com/python-f-strings/).
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
Which Python statement correctly replaces the schema name and table name in a query using f-strings?
A
table_name = 'sales' schema_name = 'bronze' query = f'select * from { schema_name}.{table_name}'
B
table_name = 'sales' schema_name = 'bronze' query = 'select * from {schema_name}.{table_name}'
C
table_name = 'sales' schema_name = 'bronze' query = f'select * from schema_name.table_name'
D
table_name = 'sales' schema_name = 'bronze' query = f'select * from + schema_name +'.'+table_name'