3. Running Queries, Creating Databases and Tables, and Loading Data : Using the Vector Command Line Interface : Run Queries with Actian Vector CLI
 
Share this page                  
Run Queries with Actian Vector CLI
The Vector instance comes pre-installed with the ontimedb demonstration database, which is loaded with actual airline flight data from the U.S. Bureau of Transportation from 1987 to the present—175 million rows.
This first query will show you the year, month, and number of flights per month ordered by year and then month from the ontime table of ontimedb.
To run the sample query
1. Start the Vector CLI. (See Start the Vector Command Line Interface.)
2. Start the sql tool by entering the following command at the $ prompt:
sql ontimedb
3. Specify that the following query be timed. Enter the following command at the * prompt:
\rt
4. Enter the following SQL command (copy and paste):
SELECT count(*) FROM ontime\g
Results are displayed:
5. Check the query execution time at the bottom of the results display.
6. Enter the following query to find the cities with the most flights from 2012:
SELECT TOP 10 origincityname as City, count(*) as Num_of_flights FROM ontime WHERE Year = 2012 GROUP BY origincityname ORDER BY Num_of_flights DESC;\g
You may run more sample queries from More Sample Queries.