---
lang: en
title: 'API docs: sequelize.sequelizecrudrepository.execute'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/extensions/sequelize
permalink: /doc/en/lb4/apidocs.sequelize.sequelizecrudrepository.execute.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/sequelize](./sequelize.md) &gt; [SequelizeCrudRepository](./sequelize.sequelizecrudrepository.md) &gt; [execute](./sequelize.sequelizecrudrepository.execute.md)

## SequelizeCrudRepository.execute() method

Execute a SQL command.

\*\*WARNING:\*\* In general, it is always better to perform database actions through repository methods. Directly executing SQL may lead to unexpected results, corrupted data, security vulnerabilities and other issues.

**Signature:**

```typescript
execute(command: Command, parameters?: NamedParameters | PositionalParameters, options?: Options): Promise<AnyObject>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  command | Command | A parameterized SQL command or query. |
|  parameters | NamedParameters \| PositionalParameters | _(Optional)_ List of parameter values to use. |
|  options | Options | _(Optional)_ Additional options, for example <code>transaction</code>. |

**Returns:**

Promise&lt;AnyObject&gt;

A promise which resolves to the command output. The output type (data structure) is database specific and often depends on the command executed.

## Example


```ts
// MySQL
const result = await repo.execute(
  'SELECT * FROM Products WHERE size > ?',
  [42]
);

// PostgreSQL
const result = await repo.execute(
  'SELECT * FROM Products WHERE size > $1',
  [42]
);
```


