Tuesday, March 18, 2014

AtomSQL - Simple Database Query Language for RDBMS & NoSQL Systems

AtomSQL came from the frustration of working too much with RDBMS systems and typing too much to get the necessary data from the Databases.

This post is an introduction to AtomSQL

Lets go through the following examples to see how we use SQL queries normally and in AtomSQL Format.

1. Create a new table

BEFORE:
CREATE TABLE myTable (id INTEGER PRIMARYKEY, name VARCHAR(255) ENGINE=INNODB


AFTER:

myTable { id INTEGER PRIMARY KEY, name VARCHAR(255) } ENGINE=INNODB


So, what has changed ???

We just got rid of the keywords and are letting the {} do the necessary JOB.

TIP: Remember C/C++ Structures ?

2. Inserting new records to the table

Before:

INSERT INTO myTable VALUES (1, 'Tom'), (2, 'Jerry')


After:

myTable = [ (1, 'Tom'), (2, 'Jerry') ]


Again, We use () for Tuples and [] for Array representation to get the job done. Keywords have gone away !
TIP: Remember JSON, Perl Arrays ?

3. Updating records

Before

UPDATE myTable SET name = 'Jerry Mouse' Where name = 'Jerry'


After

myTable /name = 'Jerry Mouse'/ (name = 'Jerry')


Again, we are using // for replacing data and () are used for condition to be used in WHERE Clause
TIP: Remember perl, sed, vim for data replacement ?

4. Deleting records

Before

DELETE FROM myTable Where name = 'Jerry'


After

! myTable (name = 'Jerry')


! Bang is the operator for destroying stuff. () is used for WHERE Clause

5. Seleting Records

Before

SELECT * from myTable where name != 'Jerry'


After

myTable <*> (name != 'Jerry')


<> is used for Column selection and () is used for WHERE clause

More Features/Limitations/Installation can be read from http://nareshv.github.io/atomsql/

0 comments:

Post a Comment