
Explains Text-to-SQL as a backend capability rather than a chatbot feature.
Clarifies the role of the LLM versus backend control and execution.
Covers real-world backend use cases where Text-to-SQL is effective.
Also explains scenarios where it should not be used.
Introduces the high-level Text-to-SQL system architecture. Clearly explains responsibility boundaries between LLM, backend, and database.
Get IntelliJ IDEA Ultimate for free and follow this course using a professional development environment.
Redeem your 90-day access and get started quickly.
Creates the base Spring Boot project used throughout the course. Adds Spring AI dependencies and verifies the application setup.
Sets up PostgreSQL locally using Docker Compose. Verifies database connectivity from the Spring Boot application.
Introduces the fictional company and its business domains. Explains how the data model supports realistic Text-to-SQL queries.
Loads schema and sample data into PostgreSQL. Explores tables, relationships, and runs manual SQL queries.
Clarifies what the course covers and intentionally avoids. Prepares students for the core Text-to-SQL architecture in Module 2.
Explains Text-to-SQL as a backend pipeline from question to SQL execution. Focuses on responsibilities without writing any code.
Designs the REST API for Text-to-SQL requests and responses. Implements the controller and verifies it using Postman.
Introduces internal services and their responsibilities. Refactors the controller to delegate logic cleanly to the service layer.
Integrates Spring AI to generate SQL from user questions. Builds a minimal prompt and returns generated SQL via the API.
Executes AI-generated SQL using JdbcTemplate. Demonstrates real query results with joins and aggregations.
Demonstrates unsafe and incorrect SQL generation scenarios. Explains why LLMs cannot be trusted without backend validation.
Recaps the complete Text-to-SQL pipeline built so far. Explicitly lists missing safety and validation concerns.
Demonstrates common failures caused by missing schema context. Shows that errors come from ambiguity, not randomness.
Introduces a backend-controlled schema representation. Programmatically injects tables and columns into prompts.
Enhances prompts with semantic descriptions. Reduces ambiguity and improves SQL generation accuracy.
Adds domain rules as soft constraints in prompts. Demonstrates how rules guide but do not enforce behavior.
Teaches structured prompt design techniques. Covers common anti-patterns and best practices.
Explains why static, hardcoded schemas break down in real systems. Clarifies the scope of dynamic schema discovery versus validation and safety.
Implements runtime schema discovery using PostgreSQL metadata. Integrates the dynamic schema into the existing prompt pipeline.
Loads table and column descriptions using PostgreSQL comments. Separates structural schema data from semantic meaning.
Caches schema at application startup for predictable behavior. Discusses schema refresh strategies at a conceptual level.
Verifies dynamic schema behavior with multi-domain queries. Summarizes capabilities gained and prepares for SQL safety and validation.
Explains why prompts and schema awareness cannot guarantee safe SQL.
Shows where validation fits between SQL generation and execution.
Implements an AST-based SQL validator using a real SQL parser.
Enforces SELECT-only rules and blocks all DML and DDL statements.
Validates tables and columns against the discovered schema.
Demonstrates failures caused by hallucinated tables, columns, and aliases.
Detects missing LIMIT clauses and enforces maximum row limits.
Wires the validator before execution and blocks unbounded queries.
Summarizes the final validated execution flow.
Clearly states the safety guarantees enforced by the backend.
Uses a prebuilt HTML file to call the existing API using JavaScript fetch.
Displays generated SQL and query results as a table in the browser.
Shows how backend validation errors appear clearly in the interface.
Demonstrates that all safety logic lives in the backend, not the UI.
Text-to-SQL is one of the most powerful real-world use cases for Large Language Models. The idea is simple: a user asks a question in plain English, and the system generates and executes SQL automatically.
> Doing this with ChatGPT is easy.
> Doing this safely and correctly inside a backend system is not.
This course teaches you how to build a complete, production-style Text-to-SQL system using Spring AI, Spring Boot, and PostgreSQL, with clear architecture, strong backend control, and zero reliance on “AI magic”.
You will not build a chatbot.
You will not build a dashboard.
You will build a backend system that you could confidently use at work.
Includes professionally prepared subtitles in Spanish, Portuguese (Brazil), Japanese, and Chinese.
Includes free 90-day access to IntelliJ IDEA Ultimate for a professional development experience.
What makes this course different
Most AI + SQL demos you see online follow this pattern:
User question → LLM → SQL → Database
This course shows why that is dangerous, and how to design the system properly:
User question → Spring Boot backend → LLM → SQL validation → Database
The LLM suggests.
The backend controls everything.
What you will build
Throughout the course, you will work on a single Spring Boot project that evolves module by module. Instead of toy examples, you will use a realistic company database (employees, projects, customers, orders, invoices, payments) so queries feel like real systems.
You will build:
A Text-to-SQL API using Spring AI
Schema-aware prompt design to improve SQL accuracy
Dynamic schema discovery from PostgreSQL at runtime
AST-based SQL validation to block unsafe queries
Table and column validation using real schema
LIMIT enforcement and execution gating
A simple UI that consumes the API and displays results and errors
By the end, you will have a working system where a plain English question turns into safe, validated SQL and real database results.
What you will learn
You will learn how to:
Design a clean Text-to-SQL architecture in Spring Boot
Control LLM behavior using schema, prompts, and backend logic
Discover and manage database schema dynamically
Prevent dangerous SQL from ever reaching your database
Integrate a simple UI with a backend AI-powered API
Understand where RAG is useful — and where it is not
Who this course is for
This course is designed for:
Java and Spring Boot developers exploring real AI use cases
Backend engineers who care about architecture and safety
Developers comfortable with SQL who want to automate queries using AI
Engineers who want practical AI integration, not demos
This course is not focused on frontend development, dashboards, or prompt-only experiments.
The end result
By the end of this course, you will understand how to integrate LLMs into backend systems in a controlled, production-ready way and build a safe Text-to-SQL system from scratch using Spring AI.