NL2SQL Project

Overview

Developed an advanced NL2SQL system that transforms natural language queries into SQL commands on a restructured database adhering to Boyce-Codd Normal Form (BCNF). The system serves both clients and employees, offering intuitive database interactions while ensuring security and privacy.

Database Restructuring

  • Restructured the database to comply with RDBMS principles and achieve BCNF.
  • Migrated data to the new BCNF-compliant database.

NL2SQL System

  • Client Interface: Allows clients to use natural language queries without seeing SQL commands.
  • Employee Interface: Provides SQL queries for verification and use.
  • Query Checking: Ensures syntactically correct and optimized SQL queries.
  • Chart Generation: Generates and executes Python code for real-time data visualization.

Technologies Used

  • LangChain: Manages workflow and integration.
  • OpenAI API: Powers natural language understanding and SQL generation.
  • Python: Executes dynamic code for data visualization.
  • SQL: Core language for database interaction.

Implementation Highlights

  • Integrated LangChain for workflow management.
  • Used OpenAI to generate SQL commands from natural language.
  • Developed modules for query checking and real-time chart generation.

Benefits

  • User-Friendly: Simplifies database queries through natural language.
  • Efficient: Streamlines query generation, reducing errors.
  • Secure: Maintains privacy by hiding SQL from clients, transparent for employees.
  • Dynamic: Real-time data visualization enhances decision-making.

Conclusion

The NL2SQL project offers a robust and user-friendly solution for database interaction, leveraging advanced technologies and strict normalization principles.