ABC Corp needs you to find the name and department of employees with payment entries greater than a given amount (e.g., 3000.00).
Create a record named HighPayment to return the required data. The definition of the record is as follows.
type HighPayment record {
string name;
string department;
decimal amount;
string reason;
};Use the query operation of the JDBC client to get the required data from the database.
NOTE: Order the result by the
payment_idin ascending order.
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, which will run against the given sample DB.Input: dbFilePath : “/Path/to/file/gofigure”, amount : 3000
Output: [{"name":"Anita Bath","department":"Marketing", "amount":3400, "reason": "Stationary"}, {"name":"Amanda Hug","department":"Engineering", "amount":4400, "reason": "Travel expenses"}]
ABC Corp needs you to find the name and department of employees with payment entries greater than a given amount (e.g., 3000.00).
Create a record named HighPayment to return the required data. The definition of the record is as follows.
type HighPayment record {
string name;
string department;
decimal amount;
string reason;
};Use the query operation of the JDBC client to get the required data from the database.
NOTE: Order the result by the
payment_idin ascending order.
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, which will run against the given sample DB.Input: dbFilePath : “/Path/to/file/gofigure”, amount : 3000
Output: [{"name":"Anita Bath","department":"Marketing", "amount":3400, "reason": "Stationary"}, {"name":"Amanda Hug","department":"Engineering", "amount":4400, "reason": "Travel expenses"}]