Skip to content

Latest commit

 

History

History
51 lines (42 loc) · 762 Bytes

like.md

File metadata and controls

51 lines (42 loc) · 762 Bytes

Using LIKE Clause:

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' }
]