# Target SQL scripts

With Telosys you can generate SQL scripts to manage your database (create table, drop table, foreign key definition, etc).

As SQL statements may differ depending on the type of database you are targeting, Telosys has a configuration system that allows the generated SQL to be adapted to the target database.

This can be done in 2 ways:

* using [**predefined rules**](/target-sql-scripts/predefined-rules.md)&#x20;
* using [**specific rules**](/target-sql-scripts/specific-rules.md)

### Database customization behavior

If **no rules** have been defined (neither predefined nor specific), then the "**ANSI-SQL**" will be used by default.

If you have defined both predefined rules and specific rules, the specific rules will apply (the more specific takes precedence).

Whatever your rules definition, if an entity or an attribute has database annotations in the model (@DbName, @DbType, @DbTable, etc) those annotations will be used first.

In the templates the database configuration has an influence on:&#x20;

* $entity.sqlTableName&#x20;
* $entity.sqlPrimaryKeyColumns&#x20;
* $entity.sqlPrimaryKeyColumnsAsString<br>
* $attribute.sqlColumnName&#x20;
* $attribute.sqlColumnType&#x20;
* $attribute.sqlColumnConstraints<br>
* $fk.sqlName&#x20;
* $fk.sqlOriginTableName&#x20;
* $fk.sqlOriginColumns&#x20;
* $fk.sqlOriginColumnsAsString&#x20;
* $fk.sqlReferencedTableName&#x20;
* $fk.sqlReferencedColumns&#x20;
* $fk.sqlReferencedColumnsAsString<br>
* $sql object


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.telosys.org/target-sql-scripts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
