# Example Dynamic SQL Use Cases

1. You have an application that takes daily snapshots of the data in one table. You write a stored procedure that takes the table name as a parameter. Using this parameter, you write dynamic queries to analyze the data for one day.

2. You have a feature tracking database where you track the features that are installed for each customer. You [write a stored procedure](https://docs.singlestore.com/cloud/reference/sql-reference/procedural-sql-reference/execute-immediate.md) that takes a customer ID as a parameter. Using dynamic SQL, you create a FEATURE table for the customer (with the customer ID) and populate this table with the default feature set.

3. You want to write a table analyzer utility that returns the number of rows in a table as well as the number of unique values in each column of the table. Using dynamic SQL, you [write a stored procedure](https://docs.singlestore.com/cloud/reference/sql-reference/procedural-sql-reference/execute-immediate.md) that accepts the table name as a parameter and runs the calculations.

***

Modified at: April 24, 2021

Source: [/cloud/developer-resources/procedural-extensions/dynamic-sql/example-dynamic-sql-use-cases/](https://docs.singlestore.com/cloud/developer-resources/procedural-extensions/dynamic-sql/example-dynamic-sql-use-cases/)

(An index of the documentation is available at /llms.txt)
