1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-23 09:42:07 +02:00
tldr/pages/common/usql.md
Alejandro Cervera 596d7a57e4
pages.es, pages: update some outdated Spanish translations and fix minor issues in original pages (#12975)
Co-authored-by: spageektti <git@spageektti.cc>
Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com>
Co-authored-by: Darío Hereñú <magallania@gmail.com>
2024-06-18 16:02:42 +02:00

32 lines
720 B
Markdown

# 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}}"`
- 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/file_with_results}}`
- Import data from a CSV file into a specific table:
`{{prompt}}=> \copy {{path/to/data.csv}} {{table_name}}`