# SQLite

## 00. Basic

```sql
## ------------------| Open database
sqlite3 <db_file.sqlite3>

## ------------------| Config display output
.headers on
.mode table --wrap 200 --wordwrap off --noquote
.mode column    # Displays each row in a table-like format, with column headers separated from the data. 
.mode list      # Displays each row as a list of values, with columns separated by a pipe character.
.mode line      # Similar to list mode, but displays each row on a separate line
.mode csv       # Outputs query results in Comma-Separated Values format, which can be useful for exporting data.
.mode insert    # Formats query results as SQL INSERT statements, which can be used to insert the data back into another table.
.mode html      # Outputs query results in HTML table format, which can be useful for web applications or reporting.
.mode ascii     # Displays query results in a simple ASCII text format.
.mode box       # Formats query results into a box-like structure.
.mode json      # Outputs query results in JSON format.
.mode markdown  # Formats query results in Markdown syntax.
.mode qbox      # Variant of the box mode, providing a different style for box-like formatting.
.mode quote     # This mode quotes all values, including NULLs, to make them safe for use in other SQL statements.
.mode table     # This mode formats query results as a plain-text table, similar to the output of a spreadsheet.
.mode tabs      # This mode separates columns with tabs, suitable for importing into spreadsheet applications or text editors.
.mode tcl       # Formats query results as a TCL list, suitable for integration with TCL scripts or applications.

## ------------------| List all databaeses
.databases
SELECT * FROM pragma_database_list;
SELECT name FROM pragma_database_list;

## ------------------| Show Tables
.tables
SELECT name FROM sqlite_master WHERE type='table';

## ------------------| Show Columns
SELECT * FROM pragma_table_info('<table_name>');
PRAGMA table_info(<TB_NAME>);

## ------------------| Show data
select * from <TB_NAME>;

## ------------------| Exit
.q


```


---

# 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://docs.h4rithd.com/database/sqlite.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.
