Basic Tables: Other Operations

USE Statement

Syntax & Example
USE trading_db;

This query selects and sets the active database context to 'trading_db'. Any subsequent operations like table creation, inserts, or updates will execute inside this active database namespace. Also before any operation on any type of table you must firstly execute this query, if that particular database is not active.

DROP Statement

Syntax & Example
DROP TABLE StudentRolls;
DROP DATABASE trading_db;

DROP TABLE drops the entire "StudentRolls" table. It permanently deletes the table structure, all its rows, and its associated indices from memory and disk space. DROP DATABASE statement drops the entire database and all its tables and data from memory and disk space.

STATISTICS Statement

Syntax & Example
STATISTICS COUNT FROM StudentRolls ON roll_no WHERE roll_no="Woho"
STATISTICS MEAN FROM StudentRolls ON roll_no;
STATISTICS MAX FROM StudentRolls ON roll_no;
STATISTICS MIN FROM StudentRolls ON roll_no;

This query is analogous to Aggregate commands of MySQL. We have Count, Min, Max and Avg (Mean) functions. In above example we are calculating the count on roll_no column in StudentRolls table with a where clause. One thing to note is that only Count works on String columns. Rest all of them works only on Numeric columns.