ABC Corp needs you to load all the data from the SQL database into a Ballerina table for further processing. Then you need to find the names of employees who have payment entries greater than a given amount (e.g., 3000.00) by querying the loaded Ballerina table.
Step 1:
Create a Ballerina table with the following columns.
payment_id - integer
amount - decimal
employee_name - string
Step 2:
Populate above Ballerina table by loading the corresponding full data set in the H2 database. Use the payment_id as the primary key of the table.
Step 3
Query the Ballerina table using Ballerina query expressions to find the employee names who has payment entries greater than the given amount. Order the result by the name of employee in ascending order. Remove the duplicate name entries in the result before returning.
NOTE : It is mandatory to use Balerina table to implement the solution.
Use the provided H2 database for this problem.
The sample database file is
gofigure.mv.db, and the database name isgofigure. It is given within thedbfolder.
The following tables are already in the sample H2 database with some sample data. The column names and data types are below.
Table name : Employee
| Columns: | type |
|---|---|
employee_id | integer, auto-incremented primary key |
name | string |
city | string |
department | string |
age | integer |
Table Name: Payment
| Columns: | type |
|---|---|
payment_id | integer, auto-incremented primary key |
date | date |
amount | decimal |
employee_id | integer |
reason | string |
gofigure.mv.db. Use the JDBC URL as jdbc:h2:file:/path/to/db/filerootrootdb folder to validate queries and the Ballerina samplebal test and it will run tests against the given sample DB.Input: dbFilePath : “/Path/to/file/gofigure”, amount : 3000
Output: ["Amanda Hug", "Anita Bath"]
ABC Corp needs you to load all the data from the SQL database into a Ballerina table for further processing. Then you need to find the names of employees who have payment entries greater than a given amount (e.g., 3000.00) by querying the loaded Ballerina table.
Step 1:
Create a Ballerina table with the following columns.
payment_id - integer
amount - decimal
employee_name - string
Step 2:
Populate above Ballerina table by loading the corresponding full data set in the H2 database. Use the payment_id as the primary key of the table.
Step 3
Query the Ballerina table using Ballerina query expressions to find the employee names who has payment entries greater than the given amount. Order the result by the name of employee in ascending order. Remove the duplicate name entries in the result before returning.
NOTE : It is mandatory to use Balerina table to implement the solution.
Use the provided H2 database for this problem.
The sample database file is
gofigure.mv.db, and the database name isgofigure. It is given within thedbfolder.
The following tables are already in the sample H2 database with some sample data. The column names and data types are below.
Table name : Employee
| Columns: | type |
|---|---|
employee_id | integer, auto-incremented primary key |
name | string |
city | string |
department | string |
age | integer |
Table Name: Payment
| Columns: | type |
|---|---|
payment_id | integer, auto-incremented primary key |
date | date |
amount | decimal |
employee_id | integer |
reason | string |
gofigure.mv.db. Use the JDBC URL as jdbc:h2:file:/path/to/db/filerootrootdb folder to validate queries and the Ballerina samplebal test and it will run tests against the given sample DB.Input: dbFilePath : “/Path/to/file/gofigure”, amount : 3000
Output: ["Amanda Hug", "Anita Bath"]