From Lang Chain Documentation
SQLDatabaseChain is a simple chain that allows executing SQL queries against a database. It takes a SQLDatabase object and sequentially calls tools like sql_query and sql_print_result to run and print queries.
create_sql_agent creates a more advanced SQL agent using the SQLDatabaseToolkit. The key advantages of the SQL agent are:
It can answer questions about the database schema and content, not just run queries. For example it can describe a table when asked.
It uses a ReAct style prompt to plan actions and generate queries based on observations. This allows it to handle more complex workflows.
It can recover from errors by catching exceptions, understanding the failure, and trying again. For example regenerating a query if the first attempt errors.
So in summary:
SQLDatabaseChain is simpler but limited to just executing queries
The SQL Agent created by create_sql_agent is more advanced and flexible, able to understand questions, plan actions, recover from failures etc.