In the last article we saw on how do we connect to the BigAnimal and how we create a database. In this article we will be populating the table with sample data and querying it.
You can access the last article over here
Create a table:
Create a table named associates for storing the status of the employees either active or non active.
CREATE TABLE employees(
id INTEGER,
status STRING,
PRIMARY KEY (id)
);
Populate the database with some employees status and their ids
INSERT INTO employees (id, status) VALUES
(1, 'active'),
(2, 'inactive'),
(3, 'active'),
(4, 'terminated');
Querying on the table:
The below query will display the active employees
SELECT id, status
FROM employees
WHERE status = 'active';
Similarly you can make more tables in the database, populate the data and then query over the data.
Top comments (0)