SQL made uagliò.

Overview

Travis Maintainability Test Coverage Join the chat at https://gitter.im/gomorra-sql/community Donate

logo

GomorraSQL is an easy and straightforward interpreted SQL dialect that allows you to write simpler and more understandable queries in Neapolitan Language.

Set up

GomorraSQL can be used either as a Java library or as a standalone SQL database client.

Java library

To use it as a Java library, download the latest jar in the release section and import it into your project, along with the driver of the database you want to use. Then, you can use the methods exposed by the class co.aurasphere.gomorrasql.GomorraSqlInterpreter which allow you to either execute a GomorraSQL query against your database (to which you will provide a connection) or just translate it into plain old SQL. GomorraSQL throws a CaggiaFaException with useful debugging information whenever an error occurs.

Database client

To use GomorraSQL as a database client, download the latest jar in the release section and execute it with the command:

java -cp gomorra-sql-1.0.0.jar;<path_to_your_db_driver> co.aurasphere.gomorrasql.GomorraSqlShell

The client will ask for a JDBC string representing the database to connect to (including credentials). After the connection is established, you can start running commands.

Language basics

Before delving into the specific commands, it's important to consider some general rules to avoid "cuoppo" mistakes:

  • parenthesis are not valid characters in GomorraSQL queries. In the following examples, they are just used to distinguish between (mandatory parameters) and [optional parameters]
  • GomorraSQL doesn't allow multi-line queries. Therefore, there's no end-of-query character (like ; in SQL)
  • spacing is very important when using operators! A query using a condition a = 5 will work but the same query with a= 5 or a =5 or a=5 will not

Data Manipulation Language

Likewise standard SQL, GomorraSQL allows performing data manipulation. Here's a list of supported operations:

Retrieving data

To retrieve data, you can use the ripigliammo command. Here's the command syntax:

ripigliammo (<comma_separated_column_names> || tutto chillo ch'era 'o nuostro) mmiez 'a <table_name> [pesc e pesc <table_name>...] [arò <condition>]

The first argument for the ripigliammo command is the columns to retrieve. They can be specified either as a list of comma-separated values or with the tutto chillo ch'era 'o nuostro which will return all the columns.

After the columns, the following parameter is the name of the table where to fetch the data with mmiez 'a. Data can be fetched from multiple tables by using the optional join operator pesc e pesc followed by another table name. Currently, there's no limit on the number of pesc e pesc that can be applied to a single ripigliammo. The join condition is specified in the arò clause, along with the row filtering.

Finally, you can filter the rows using the optional arò clause, followed by one or more conditions. The conditions work exactly like in SQL, with a slightly different syntax for some operators (check the Language Reference section).

Here are some sample queries:

ripigliammo tutto chillo ch'era 'o nuostro mmiez 'a user  # retrieves all users' data
ripigliammo email mmiez 'a user arò id = 6 o name è nisciun  # retrieves all the emails of the users with id 6 or null name
ripigliammo email mmiez 'a user pesc e pesc city pesc e pesc account arò user.id = 6 e user.birth_city = city.id e user.account_id = account.id  # retrieves the data of the user with id 6 along joined with his birth city and his account data

Deleting data

Data deletion can be performed using the facimm na' strage command which supports a subset of options from the ripigliammo command. Here's the syntax:

facimm na' strage mmiez 'a <table_name> [arò <condition>]

Here are some sample queries:

facimm na' strage mmiez 'a user  # deletes all users' data
facimm na' strage mmiez 'a user arò name nun è nisciun o deleted è true  # deletes the users with name not null or with deleted = true

Updating data

The command rifacimm is used to update data in a table. The syntax is:

rifacimm <table_name> accunza <column_1> accussì <value_1>, <column_2> accussì <value_2>, ... [arò <conditions>]

The accunza operator marks the begin of a list of column/values assignments using the assignment operator accussì.

Here are some sample queries:

rifacimm user accunza name accussì "Pippo"  # sets the name "Pippo" for all the users
rifacimm user accunza name accussì "Pinco", surname accussì "Pallo" arò name è nisciun  # sets the name to "Pinco" and surname to "Pallo" for all users with null name

Inserting data

Data insertion can be performed using the nzipp 'ngoppa operator as following:

nzipp 'ngoppa <table_name> (<column_1>, <column_2>...) chist <value_1>, <value_2>...

After the table name, you can specify a list of columns whose data are being inserted. If not present, GomorraSQL will default to all columns. The chist keyword marks the beginning of a comma-separated list of values to insert. Each insert statement can only add one row.

Here are some sample queries:

nzipp 'ngoppa user chist 1, "Pinco", "Pallo"  # inserts a new user with all his data
nzipp 'ngoppa user name chist "Pinco"  # inserts a new user with only his name set

Transaction support

Being a fully ACID compliant language, GomorraSQL offers basic transaction management. To begin a transaction, you can issue the command ua uagliò. You can then commit the transaction with the command iamme bello ia' or perform rollback with the command sfaccimm.

Language reference

Follows a table that roughly maps GomorraSQL language to standard SQL:

GomorraSQL keyword SQL equivalent Valid in...
ripigliammo SELECT SELECT
rifacimm UPDATE UPDATE
nzipp INSERT INSERT
'ngoppa INTO INSERT
facimm na' strage DELETE DELETE
pesc e pesc INNER JOIN SELECT
mmiez 'a FROM SELECT, DELETE
tutto chillo ch'era 'o nuostro * SELECT
arò WHERE SELECT, UPDATE, DELETE
e AND ANY WHERE CLAUSE
o OR ANY WHERE CLAUSE
nisciun NULL ANY WHERE CLAUSE
è IS ANY WHERE CLAUSE
nun è IS NOT ANY WHERE CLAUSE
chist VALUES INSERT
accunza SET UPDATE
accussì = (assignment) UPDATE
> > ANY WHERE CLAUSE
< < ANY WHERE CLAUSE
= (comparison) = (comparison) ANY WHERE CLAUSE
!= != ANY WHERE CLAUSE
<> <> ANY WHERE CLAUSE
<= <= ANY WHERE CLAUSE
>= >= ANY WHERE CLAUSE
sfaccimm ROLLBACK TRANSACTION
iamme bello ia' COMMIT TRANSACTION
ua uagliò BEGIN TRANSACTION TRANSACTION

Supported Database

GomorraSQL has been extensively tested with MySQL and H2. Other databases may not work properly.

Training

Video lessons on GomorraSQL syntax and philosophy are available here. If you are also interested in corporate training, feel free to contact me for pricing.

Certifications

If you have an issued certification, you can check it out at the following URL by replacing the "user" parameter with your name (replace spaces with hyphens): https://aurasphere.co/gomorra-sql/certificate.html?user=donato-rimenti.

Contributions

Improvements are always appreciated! If you want to contribute to this project though, remember to open an issue with your suggestion before doing any changes. This will help you avoid working on something that won't get merged.

Project status

This project is considered completed and won't be developed further.

Contacts

You can contact me using my account e-mail or opening an issue on this repo. I'll try to reply ASAP.

Acknowledgments

Thanks to Federica Lisci for the logo!

License

The project is released under the MIT license, which lets you reuse the code for any purpose you want (even commercial) with the only requirement being copying this project license on your project.

Copyright (c) 2021 Donato Rimenti

You might also like...

SQL tasarım komutları ve Backend yazıldı. Projeye yıldız Vermeyi Unutmayın 🚀 Teşekkürler! ❤️

HumanResourcesManagementSystem-HRMS SQL tasarım komutları ve Backend yazıldı. Projeye yıldız Vermeyi Unutmayın 🚀 Teşekkürler! ❤️ insan kaynakları yön

Nov 6, 2022

The public release repository for SUSTech SQL (CS307) course project 2.

CS307 Spring 2021 Database Project 2 1. Source code Download link: For java: https://github.com/NewbieOrange/SUSTech-SQL-Project2-Public For python: h

Dec 26, 2022

Multi-DBMS SQL Benchmarking Framework via JDBC

BenchBase BenchBase (formerly OLTPBench) is a Multi-DBMS SQL Benchmarking Framework via JDBC. Table of Contents Quickstart Description Usage Guide Con

Dec 29, 2022

HasorDB is a Full-featured database access tool, Providing object mapping,Richer type handling than Mybatis, Dynamic SQL

HasorDB is a Full-featured database access tool, Providing object mapping,Richer type handling than Mybatis, Dynamic SQL

HasorDB is a Full-featured database access tool, Providing object mapping,Richer type handling than Mybatis, Dynamic SQL, stored procedures, more dialect 20+, nested transactions, multiple data sources, conditional constructors, INSERT strategies, multiple statements/multiple results. And compatible with Spring and MyBatis usage.

Oct 27, 2022

An open source SQL database designed to process time series data, faster

An open source SQL database designed to process time series data, faster

English | 简体中文 | العربية QuestDB QuestDB is a high-performance, open-source SQL database for applications in financial services, IoT, machine learning

Jan 1, 2023

Free universal database tool and SQL client

Free universal database tool and SQL client

DBeaver Free multi-platform database tool for developers, SQL programmers, database administrators and analysts. Supports any database which has JDBC

Jan 1, 2023

Simple but powerful SQL library for tiny projects

KiORM - Simple and powerful MySQL Java library for tiny projects Notice: KiORM is still in SNAPSHOT state. The code is not tested, there is no Javadoc

Sep 13, 2022

A Java library to query pictures with SQL-like language

A Java library to query pictures with SQL-like language

PicSQL A Java library to query pictures with SQL-like language. Features : Select and manipulate pixels of pictures in your disk with SQL-like dialect

Dec 25, 2022
Comments
  • Add a Gitter chat badge to README.md

    Add a Gitter chat badge to README.md

    aurasphere/gomorra-sql now has a Chat Room on Gitter

    @aurasphere has just created a chat room. You can visit it here: https://gitter.im/gomorra-sql/community.

    This pull-request adds this badge to your README.md:

    Gitter

    If my aim is a little off, please let me know.

    Happy chatting.

    PS: Click here if you would prefer not to receive automatic pull-requests from Gitter in future.

    opened by gitter-badger 0
  • Added cumme for field alias

    Added cumme for field alias

    I

    I have add the optional keyword AS on fields using cumme

    ripigliammo first_name cumme nome, last_name cumme cognome mmiez 'a user

    is translated in ->

    select first_name as nome, last_name as cognome from user

    all the best matteo baccan

    enhancement 
    opened by matteobaccan 3
Releases(1.0.0)
Owner
Donato Rimenti
I'm a professional bug designer.
Donato Rimenti
🚀flink-sql-submit is a custom SQL submission client

??flink-sql-submit is a custom SQL submission client This is a customizable extension of the client, unlike flink's official default client.

ccinn 3 Mar 28, 2022
Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)

Trino is a fast distributed SQL query engine for big data analytics. See the User Manual for deployment instructions and end user documentation. Devel

Trino 6.9k Dec 31, 2022
requery - modern SQL based query & persistence for Java / Kotlin / Android

A light but powerful object mapping and SQL generator for Java/Kotlin/Android with RxJava and Java 8 support. Easily map to or create databases, perfo

requery 3.1k Jan 5, 2023
The official home of the Presto distributed SQL query engine for big data

Presto Presto is a distributed SQL query engine for big data. See the User Manual for deployment instructions and end user documentation. Requirements

Presto 14.3k Dec 30, 2022
jOOQ is the best way to write SQL in Java

jOOQ's reason for being - compared to JPA Java and SQL have come a long way. SQL is an "ancient", yet established and well-understood technology. Java

jOOQ Object Oriented Querying 5.3k Jan 4, 2023
CrateDB is a distributed SQL database that makes it simple to store and analyze massive amounts of machine data in real-time.

About CrateDB is a distributed SQL database that makes it simple to store and analyze massive amounts of machine data in real-time. CrateDB offers the

Crate.io 3.6k Jan 2, 2023
jdbi is designed to provide convenient tabular data access in Java; including templated SQL, parameterized and strongly typed queries, and Streams integration

The Jdbi library provides convenient, idiomatic access to relational databases in Java. Jdbi is built on top of JDBC. If your database has a JDBC driv

null 1.7k Dec 27, 2022
Java code generator for calling PL/SQL.

OBridge OBridge provides a simple Java source code generator for calling Oracle PL/SQL package procedures. Supported input, output parameters and retu

Ferenc Karsany 21 Oct 7, 2022
Persistent priority queue over sql

queue-over-sql This projects implement a persistent priority queue (or a worker queue) (like SQS, RabbitMQ and others) over sql. Why? There are some c

Shimon Magal 13 Aug 15, 2022