usql: add page (#12275)

* usql: add page

---------

Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
pull/23/head
Vitor Henrique 2024-02-19 11:34:37 -03:00 committed by GitHub
parent 23bbfa72ea
commit 0781cf1656
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 36 additions and 0 deletions

36
pages/common/usql.md Normal file
View File

@ -0,0 +1,36 @@
# usql
> Universal CLI interface for SQL databases.
> More information: <https://github.com/xo/usql>.
- Connect to a specific database:
`usql {{sqlserver|mysql|postgres|sqlite3|...}}://{{username}}:{{password}}@{{host}}:{{port}}/{{database_name}}`
- Execute commands from a file:
`usql --file={{path/to/query.sql}}`
- Execute a specific SQL command:
`usql --command="{{sql_command}}"`
- List databases available on the server:
`usql --list-databases`
- Run an SQL command in the `usql` prompt:
`{{prompt}}=> {{command}}`
- Display the database schema:
`{{prompt}}=> \d`
- Export query results to a specific file:
`{{prompt}}=> \g {{/path/to/results.txt}}`
- Import data from a CSV file into a specific table:
`{{prompt}}=> \copy {{/path/to/data.csv}} {{table_name}}`