Text to SQL: Amazon Redshift Serverless for Generative SQL in Amazon Q
2h 50mIntermediate2025-05-23
Authors

Wendy Wong
Course details
Are you ready to extract data and gain faster insights? In this course, learn how to enable text to SQL with AI-powered assistant Amazon Q in Amazon Redshift Query Editor to generate queries with prompt engineering and retrieval-augemented generation (RAG). Instructor Wendy Wong takes you through the architecture of Amazon Q to help you identify table schemas from your data and redefine the heavy lifting of figuring out table relationships. Along the way, learn to use prompts in natural language to produce customized SQL. By the end of this course, you’ll be prepared to use Amazon Q to help you to troubleshoot coding errors and regenerate code that you can run in SQL Notebook.
Learning objectives
Discover and extract data by using natural language to generate SQL queries.
Create intermediate- and advanced-level SQL queries and rerun them directly from SQL Notebook.
Identify and debug SQL errors using the generative SQL console.
Explain the benefits of using Amazon Q generative SQL in Amazon Redshift Query Editor. Describe the solution architecture of how SQL queries are generated based on context with prompt engineering and retrieval augmented generation (RAG).
Learning objectives
Discover and extract data by using natural language to generate SQL queries.
Create intermediate- and advanced-level SQL queries and rerun them directly from SQL Notebook.
Identify and debug SQL errors using the generative SQL console.
Explain the benefits of using Amazon Q generative SQL in Amazon Redshift Query Editor. Describe the solution architecture of how SQL queries are generated based on context with prompt engineering and retrieval augmented generation (RAG).
Skills covered
Amazon QDesktop DatabasesSQLDatabase AdministrationData EngineeringDatabase DevelopmentAmazon Web Services (AWS)AmazonGenerative AIDatabase ManagementData AnalysisArtificial Intelligence (AI)Programming LanguagesData ScienceBusiness Analysis and StrategyBusiness Software and ToolsOpen SourceSoftware DevelopmentDeep Dive (X:Y)
Concepts
0. Introduction
- 01 - Text to SQL with Amazon Q
- 02 - What you should know
1. Text to SQL
- 03 - Applications of generative AI
- 04 - Generating code with prompt engineering
- 05 - Common use cases
2. Generative SQL in Amazon Redshift Serverless
- 06 - Case study 1
- 07 - Case study 2
- 08 - Amazon Q generative SQL in Amazon Redshift
- 09 - Understanding the benefit of Redshift
3. Getting Started with Generative SQL
- 10 - Natural language processing (NLP)
- 11 - Use cases for NLP
- 12 - Prerequisite knowledge
- 13 - Supported AWS regions
- 14 - Understanding pricing options
- 15 - Data privacy and security
- 16 - Experimentation
4. Solution Architecture of LLMs
- 17 - Generating SQL queries
- 18 - Understanding the solution architecture
- 19 - Prompt engineering in SQL query context
- 20 - RAG in SQL query context
- 21 - How are SQL queries generated
- 22 - Accessing query history
- 23 - Best practice - Asking a good question
- 24 - Troubleshooting SQL query errors
5. Create a Serverless Database
- 25 - Introduction to Amazon Redshift
- 26 - Amazon Redshift provisioned clusters
- 27 - Understanding Amazon Redshift Serverless
- 28 - Spinning up a database in Amazon Redshift Serverless
- 29 - Understanding IAM permissions
- 30 - Creating a workgroup
- 31 - Launching query editor
6. Create a Table
- 32 - Introducing the datasets
- 33 - Open data source options
- 34 - Writing a query to create a table in Amazon Redshift Query Editor
- 35 - Loading data into the table
- 36 - Understanding structured data
- 37 - Defining a schema
- 38 - Viewing the schema
- 39 - Tables and schemas
7. Intermediate SQL
- 40 - Producing more relevant SQL queries
- 41 - Debugging SQL error messages
- 42 - Filtering data
- 43 - Multi-table joins
- 44 - Creating CASE statements
- 45 - Exploring nested queries
- 46 - Determining the number of working days between two dates
- 47 - Creating a view
8. Advanced SQL
- 48 - Computing a running total
- 49 - Finding duplicate rows
- 50 - Counting duplicate rows
- 51 - Obtaining all rows where the result is in a subquery result
- 52 - Grouping data with ROLLUP
- 53 - Finding the top 10 rows of a result set
- 54 - Ranking the rows on specific criteria
- 55 - Listing the highest row of a result set
Conclusion
- 56 - Cleaning up resources
- 57 - Summarizing the course
- 58 - Resources for additional learning