> For the complete documentation index, see [llms.txt](https://yogesh-aggarwal.gitbook.io/sql-tools/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yogesh-aggarwal.gitbook.io/sql-tools/sqlite/quick-functions.md).

# Quick Functions

SQLite contains several functions for performing different types of options whether they are small or big. We don't have to write the SQL query to perform them every time just for a sneak peek.

## getCNames

This function is used often when we have to retrieve the column names of tables(s).

```python
sqlite.getCNames(
    [
        ["table1_db1", "table2_db1"],
        ["table1_db2", "table2_db2"]
    ]
)
```

**Output:**

```
[
    [columns of table1_db1, columns of table2_db1],
    [columns of table1_db2, columns of table2_db2]
]
```

## getNColumns

Same as `getCNames` but instead of returning the names of columns, it returns the number of columns.

```python
sqlite.getCNames(
    [
        ["table1_db1", "table2_db1"],
        ["table1_db2", "table2_db2"]
    ]
)
```

**Output:**

```
[
    [n(columns) of table1_db1, n(columns) of table2_db1],
    [n(columns) of table1_db2, n(columns) of table2_db2]
]
```

## getNRecords

This function is used when we have to calculate the no. of records in a table.

```python
sqlite.getNRecords(
    [
        ["table1_db1", "table2_db1"],
        ["table1_db2", "table2_db2"]
    ]
)
```

**Output:**

```
[
    [n(records) of table1_db1, n(records) of table2_db1],
    [n(records) of table1_db2, n(records) of table2_db2]
]
```

The output will be the same as the by `getNColumns` but this time the count is for records instead of columns. It returns `list` as the result.

## getTCommand

This function is often used when we have get the command using which the specified tables was created. The order of output is same as of all other functions.

```python
sqlite.getTCommand(
    [
        ["table1_db1", "table2_db1"],
        ["table1_db2", "table2_db2"]
    ]
)
```

**Output:**

```
[
    [command of table1_db1, command of table2_db1],
    [command of table1_db2, command of table2_db2]
]
```

## getTNames

This function is often used when we have get the names of tables in database(s).

```python
sqlite.getTCommand(
    [
        ["table1_db1", "table2_db1"],
        ["table1_db2", "table2_db2"]
    ]
)
```

**Output:**

```
[
    [command of table1_db1, command of table2_db1],
    [command of table1_db2, command of table2_db2]
]
```

## getDbSize

This function is used when we have to get the size of database(s).

```python
sqlite.getDbSize(
    ["db1", "db2"]
)
```

**Output:**

```python
[
    "size of db1",
    "size of db2"
]
```

**For example:**

```python
[
    '106496 bytes (0.106496 MB)',
    '126345 bytes (0.126345 MB)'
]
```

## getSampleDb

This function is useful when we have to perform some test (or experiment) operations on a database apart from our main database. This function generates a sample database for those tests.

This function generates two types of databases, `big` or `small`.

```python
sqlite.getSampleDb("db name", bigData=True)  # Will generate big data
sqlite.getSampleDb("db name", bigData=False)  # Will generate small data
```

{% hint style="info" %}
`bigData=False` will generate data with 3 tables `city (1000 records)`,  `country (239 records)`, `countrylanguage (303 records)`
{% endhint %}

{% hint style="info" %}
`bigData=True` will generate data with 3 tables `city (2500 records)`,  `country (239 records)`, `countrylanguage (984 records)`
{% endhint %}

**Note:** This data is taken from MySQL data repository and not generated by SQL-Tools team.
