Skip to content

Tutorials

Welcome to the General SQL Parser .NET tutorials! These learning-oriented guides teach you how to use GSP through hands-on C# examples. Each tutorial builds on the previous one — we recommend going through them in order.

Learning path

graph TD
    A[Getting Started with GSP] --> B[Basic SQL Parsing]
    B --> C[Working with Different Databases]
    C --> D[Advanced Features]

    A --> A1[Setup & installation]
    A --> A2[First parse example]
    A --> A3[Understanding results]

    B --> B1[Parse different SQL types]
    B --> B2[Handle parse errors]
    B --> B3[Extract SQL elements]

    C --> C1[Oracle PL/SQL]
    C --> C2[SQL Server T-SQL]
    C --> C3[PostgreSQL extensions]
    C --> C4[MySQL specifics]

    D --> D1[SQL transformation]
    D --> D2[Dependency analysis]
    D --> D3[Custom visitors]
    D --> D4[Performance tuning]

Tutorial overview

1. Getting Started with GSP

Time: ~30 min · Level: Beginner

Learn the fundamentals — set up GSP in a .NET console project, parse your first statement, understand the result.

You will learn:

  • How to add the gudusoft.gsqlparser NuGet package
  • Core concepts and terminology
  • How to parse a SQL statement
  • How to inspect the parse result
  • How to handle basic errors

Prerequisites: Basic C# knowledge.


2. Basic SQL Parsing

Time: ~45 min · Level: Beginner

Master the essentials of SQL parsing across all the common statement types.

You will learn:

  • Parse SELECT, INSERT, UPDATE, DELETE statements
  • Extract tables, columns, and conditions
  • Work with complex queries (JOINs, subqueries)
  • Handle different SQL statement types
  • Best practices for parsing

Prerequisites: "Getting Started with GSP".


3. Working with Different Databases

Time: ~60 min · Level: Intermediate

Explore GSP's multi-vendor support and learn to handle vendor-specific SQL.

You will learn:

  • Configure the parser for each of the 15 supported vendors
  • Handle vendor-specific syntax
  • Parse Oracle PL/SQL blocks
  • Work with SQL Server T-SQL extensions
  • Handle PostgreSQL and MySQL specifics
  • Switch between dialects

Prerequisites: "Basic SQL Parsing".


4. Advanced Features

Time: ~90 min · Level: Advanced

Unlock the full power of General SQL Parser.

You will learn:

  • AST modification and SQL re-emission with TScriptGenerator
  • Column lineage and dependency analysis
  • Implementing custom visitors via IExpressionVisitor
  • Performance tuning and parser reuse
  • Memory management for large SQL files
  • Integration with downstream .NET tooling

Prerequisites: All previous tutorials.

Tutorial structure

Each tutorial follows a consistent structure:

Tutorial format

Objectives — what you'll achieve

Prerequisites — what you need before starting

Time required — estimated completion time

Setup — environment and project setup

Step-by-step guide — hands-on exercises

Practice exercises — additional challenges

Summary — key takeaways

Related resources — links to relevant documentation

Before you start

Prerequisites

  • .NET 10 SDK installed (dotnet --info should show 10.0.x). On Ubuntu 24.04: sudo apt-get install -y dotnet-sdk-10.0.
  • IDE with C# support (Rider, Visual Studio, or VS Code with the C# Dev Kit)
  • Basic understanding of SQL syntax
  • Familiarity with C# / .NET

Setup

Make sure General SQL Parser is added to your project:

1
dotnet add package gudusoft.gsqlparser
1
<PackageReference Include="gudusoft.gsqlparser" Version="3.5.1.0" />

Sample project

We recommend creating a dedicated practice project for these tutorials:

1
2
3
dotnet new console -o GspTutorial
cd GspTutorial
dotnet add package gudusoft.gsqlparser

Replace Program.cs with:

1
2
3
4
5
// GspTutorial/Program.cs
using gudusoft.gsqlparser;

Console.WriteLine("GSP Tutorials — ready to start!");
// Tutorial code goes here.

Learning tips

Success tips

Code along — actually type the examples, don't just read them.

Experiment — try variations.

Debug — when something doesn't work, treat it as a learning opportunity.

Reference — keep the API reference handy.

Ask questions — use our support channels when stuck.

Alternative learning paths

Depending on your goals:

Goal: get GSP working in your project ASAP.

  1. Getting Started with GSP (sections 1–3 only)
  2. Performance Optimization
  3. Error Handling

Getting help

If you get stuck:

What's next?

After completing all tutorials you'll be ready to:


Ready to start? Begin with Getting Started with GSP.