ZettaSQL - the most popular Open Source SQL database management system, is developed,distributed, and supported by Ahens Corporation.
To install the application, simply follow the instructions provided in the installation guide.
To use the application, these are the existing commands:
zettasql-start
zettasql -u <username> -p
zettasql-stop
zettasql-help
create database <database_name>;
Create database command creates a new database of zettasql to work upon. A database name could be either letters or digits or alpha-numeric.
use <database_name>;
Selects the database to work with. Only existing database could be selected, otherwise it may generate error.
show databases;
Lists the existing databases in the system in a tabular format.
create table <table_name>(<field_name> <datatype(length)> <constarints>,...);
Creates tables inside the selected database. No quotes(''/"") are allowed. Length is optional Constraints & Datatypes are discussed below.
desc <table_name>;
Describes the structure of the table with given table name in tabular format.
show tables;
Lists the existing tables in the selected database in tabular format.
insert into <tabele_name> values(...);
Inserts data in the selected table. The values will be in sequence in which table was created. For skipping the field, you have to give a blank quote only, without space in that sequence. The String values for varchar and char and blob you have to enclose the value within quotes wither single('') or double("").
For Example:
insert into table1 values(1,'Value','',4);
Here the table was created with (int,varchar,int,int).
select * from <table_name>;
Displays the data from the existing (chosen) table in tabular format. You can also select fields with field name instead of * which displays all the present data.
delete from table <table_name>;
Deletes all the existing data from the selected table without deleting the structure of the table.
drop table <table_name>;
Deletes the selected table itself (data+structure).
drop database <database_name>;
Deletes the selected database itself.
Sets the integer (int
) & decimal (decimal
) value increased by one from the previous
existing values automatically if value is left blank at the time of insert.
Sets the field as primary key for identifying it. Values inserted in it can not be null. Repetition is not
allowed. The primary key for a table represents the column or set of columns that you use in your most vital
queries. It has an
associated index, for fast query performance. Query performance benefits from the NOT NULL optimization,
because it
cannot include any NULL values.
If your table is big and important, but does not have an obvious
column
or
set of columns to use as a primary key, you
might create a separate column with auto-increment values to use as the primary key. These unique IDs can
serve as
pointers to corresponding rows in other tables when you join tables using foreign keys.
Allows the field to only accept the new values i.e., repetition is not allowed. All primary keys are unique keys but all unique keys are not primary keys.
ZettaSQL supports foreign keys, which permit cross-referencing related data across tables, and foreign key
constraints, which
help keep the related data consistent.
A foreign key relationship involves a parent table that holds the initial column values, and a child table
with column
values that reference the parent column values. A foreign key constraint is defined on the child table.
A default
value clause in a data type specification explicitly indicates a default value for a
column.
Examples:
...default=Hello...
...default=1...
Stores only integer values. Range : 0-4294967295
When length is not mentioned then the default length is taken. The default length is the maxlength of range.
The CHAR and VARCHAR types are similar, but differ in the way they are stored and retrieved. They also differ
in whether trailing spaces are retained.
The CHAR and VARCHAR types are declared with a length that indicates the maximum number of characters you
want to store.
For example, CHAR(30) can hold up to 30 characters.
The length of a CHAR column is fixed to the length that you declare when you create the table. The length
can be any
value from 0 to 255. When CHAR values are stored, they are right-padded with spaces to the specified length.
When CHAR
values are retrieved, trailing spaces are removed.
Values in VARCHAR columns are variable-length strings. The length can be specified as a value from 0 to 255.
The effective maximum length of a VARCHAR is subject to the maximum row size(255 bytes, which is shared
among all columns) and the character set used.
For entering the values, quotes need to be given.
This datatype is also used to store the string data. Range : 0-65535.
When length is not mentioned then the default length is taken. The default length is the maxlength of range. For entering the values, quotes need to be given.
Stores the date in YYYY-MM-DD format. It gets stored in string type only. For entering the values, quotes need to be given.
Stores floating point or decimal number.Integer number cannot be store. If it is necessary to store the
integer value then it should be entered in decimal
format.
Example:
12.0 , 12.45 etc.
Stores either true
or false
.
select
commandTo get the track of issues and bugs, check the issues.
Website : Ahens | An Initiative to Initial
Email us : Ahens | An Initiative to Initial.
Github Link : Ahens | An Initiative to Initial.