DEV Community

Talha Munir ๐Ÿ‡ต๐Ÿ‡ธ
Talha Munir ๐Ÿ‡ต๐Ÿ‡ธ

Posted on • Edited on

Creating a table in database in BigAnimal

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) ); 
Enter fullscreen mode Exit fullscreen mode

Populate the database with some employees status and their ids

INSERT INTO employees (id, status) VALUES (1, 'active'), (2, 'inactive'), (3, 'active'), (4, 'terminated'); 
Enter fullscreen mode Exit fullscreen mode

Querying on the table:

The below query will display the active employees

SELECT id, status FROM employees WHERE status = 'active'; 
Enter fullscreen mode Exit fullscreen mode

Similarly you can make more tables in the database, populate the data and then query over the data.

References:

  1. https://www.postgresql.org/docs/
  2. https://www.enterprisedb.com/docs/biganimal/latest/free_trial/quickstart/

Top comments (0)