AI limitations
1. AI limitations
We've built a solid foundation for writing SQL with AI.2. AI limitations
AI assistants are helpful, but not perfect. Understanding their limitations helps us write better prompts and use AI more effectively.3. AI limitations
We'll explore four key AI limitations in SQL: schema knowledge gaps, data gaps, SQL flavors, and business context.4. AI limitation: schema
First, AI assistants don't automatically know the schema. They don't know what tables exist in our database, what fields they contain, the data types of the fields, the values in each record, or how the tables relate. In this course, we've provided that information so the AI assistant can generate accurate queries.5. Schema error
For example, without the schema knowledge, if we prompt "Show me all customers from New York," the AI assistant might assume the data includes cities instead of countries, resulting in an error message.6. AI limitation: data
Another limitation is that AI assistants don't know if our data has repeated, missing, or incorrect values.7. AI limitation: data
For example, an error in the order data might result in some dates being formatted differently. The AI assistant could write a query to look at this field without knowing that an additional fix is required, leading to inaccurate results.8. AI limitation: data
Similarly, if a field like country contains repeated values, and we ask “What countries are in the customers table?”, the AI assistant may assume we want to see a summarized list instead of a list of countries, including the repeated values. We can use AI and effective prompting to fix these issues, but we need to learn how to identify them first.9. AI limitation: SQL flavor
Beyond schema issues, the AI assistant may not always know what SQL flavor our database uses, generating SQL code that doesn't actually work in our database system.10. AI: business context
Finally, AI doesn't understand business context. If we ask for "seasonal products," the AI assistant doesn't know what that means for our company. It could mean holiday items or weather-dependent items, for example.11. Our experience
That kind of context comes from our experience, and we may need to provide it through specific prompts. With these limitations in mind, it's a good idea to review the query, test it on a small sample first, and check that the results make sense.12. Iterative approach
If the first result isn't right, we don't need to start over. We can take an iterative approach and modify the prompt or the query itself. The best results come from combining AI's SQL knowledge with our understanding of the data and the business.13. Be careful
One final note before we head to the exercises. Be careful when sharing extra context with an AI assistant. Many store conversation history, meaning sensitive information could be exposed if we've included it in a prompt. Always consult your company's data privacy policies or guidelines.14. Let's practice!
Let's practice.Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.