mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-03-05 10:55:50 +00:00
Update cheatsheets
This commit is contained in:
41
usql
Normal file
41
usql
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, common]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# 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}}=>
|
||||
Reference in New Issue
Block a user