# Quick Start
To get started with GridDB, we have prepared a sandbox of the GridDB server. You can get a quick rundown of the GridDB CLI from GitHub (opens new window) and from this blog (opens new window).
We have pre-loaded some containers for easy access. These containers are called: Cereal
, c001
, t001
, WeatherStation
, and InstrumentLog
. Of these containers, t001
, and InstrumentLog
are the Time Series Containers.
To query these containers, you can use either SQL or TQL. If you are unfamiliar with TQL, it is the query language used by GridDB. It very similar to SQL but has some key differences; you can read more about TQL in this blog (opens new window) and technical document.
As a rapid fire, here are some examples of commands you can run now to get your feet wet with the shell:
showcontainer Cereal
tql Cereal select *;
sql select * from Cereal;
- as a follow up:
get
orget 20
;
- as a follow up:
# About the Web CLI
Below this is a live GridDB Web CLI which you can use to interact with the GridDB Web server. When it is done loading, you will be assigned into your very own database. You can play around with this sandbox all you want -- you can delete or create containers to your heart's content.
If you prefer a terminal-style separate window, you can open up a fully interactive GridDB Web CLI using this link .
# Create Containers
You can easily create a timeseries container like so:
createtimeseries <Container name> <Compression method> <Column name> <Column type> [<Column name> <Column type> ...]
So in action it looks like:
createtimeseries ts NO colTS timestamp
With this command, you will create a Time Series Container called ts, using the NO
compression method (other options: SS
and HI
), with a singular column called colTS of type timestamp.
Once you do that, enter
showcontainer ts
to verify creation of timeseries container.
To do accomplish the same with a Collection container, the command is essentially the same:
createcollection <Container name> <Column name> <Column type> [<Column name> <Column type> ...]
createcollection col col01 string
and then
showcontainer col
# Put Rows
To insert data into your collection container like so:
putrow containername value [value...]
putrow col test
to verify your contents:
tql col select *;
and then:
get
# Querying
# SQL
To do a basic SQL query, begind your command with sql
and ends with a semi-colon.
sql select * from c001;
This will perform a search. Once the search is completed, you can simply run get
to show the results. You can also specificy the number of rows to show: get 2
.
And because it's full SQL, you can do more advanced calls like sql select * from Cereal ORDER BY CALORIES DESC;
You can also do an aggregate call: sql SELECT AVG(sugars) from Cereal;
.
# TQL
In TQL, you start the command with the letters tql
and the container name and then end with a semi-colon. You can order your results like:
tql t001 select * order by localtime asc;
You can also use conditional operators like where
. Here's an example:
tql t001 where localtime > TO_TIMESTAMP_MS(1357068660000)
It should return 4 out 6 results.