Using LIKE Clause:
July 17, 2023 ยท View on GitHub
The following SQL in the file select-employees.sql:
SELECT
employeeNumber,
lastName,
firstName
FROM
employees
WHERE
firstName LIKE 'a%'
Can be executed using the generated code:
//...
const result = await selectEmployees(conn);
console.log("result=", result);
Parameters in the LIKE Clause:
SELECT
employeeNumber,
lastName,
firstName
FROM
employees
WHERE
firstName LIKE :nameLike
//...
const result = await selectEmployees(conn, {
nameLike: 'a%'
});
console.log("result=", result);
result= [
{ employeeNumber: 1143, lastName: 'Bow', firstName: 'Anthony' },
{ employeeNumber: 1611, lastName: 'Fixter', firstName: 'Andy' }
]