About 13,800,000 results
Open links in new tab
  1. command line - How to use SQL in terminal? - Ask Ubuntu

    Oct 4, 2013 · Here is the syntax to execute sql statement from terminal. I'm assuming that you are using MySQL. Syntax: Clearificance: Example: where root is the username, mydb is the name of the database. Similary you can execute any query you want. And of-course you can create a database using terminal itself.

  2. Run PostgreSQL queries from the command line - Stack Overflow

    Jul 31, 2018 · Open "SQL Shell (psql)" from your Applications (Mac). Click enter for the default settings. Enter the password when prompted. *) Type \? for help. *) Type \conninfo to see which user you are connected as. *) Type \l to see the list of Databases. *) Connect to a database by \c <Name of DB>, for example \c GeneDB1.

  3. How To Use MySQL From The Command Line [With Examples]

    Apr 1, 2025 · Let’s have a look at an example where we take the input from a SQL file and write the output to a CSV file. Create a .sql file which have a SELECT query to get all rows from the product_details table. Save this file as get_product_details.sql. USE mysql_concepts; SELECT * FROM product_details;

  4. MySQL - How to run SQL file or script from the terminal

    Nov 2, 2021 · When you need to run a saved .sql file directly from the terminal, you can use the mysql command line client. You can run SQL scripts with or without opening a connection to the MySQL server. First, let’s see how to run SQL files while connected to a MySQL server

  5. Working with the SQL Server command line (sqlcmd) - SQL Shack

    Oct 18, 2017 · Sqlcmd allows executing queries, T-SQL sentences and SQL Server scripts using the command line. In the previous article How to work with the command line and Azure to automate tasks , we worked with the sqlcmd in Azure.

  6. 12.04 - How to run mysql command from terminal? - Ask Ubuntu

    May 19, 2017 · For you to run it from terminal, you need to be logged into mysql first and then you execute your program. The ideal code would be mysql -u(username) -p(password) (the name of the database) -e "DELETE FROM `wp_posts` WHERE `post_type` = "attachment""

  7. how to execute SQL statements in command prompt (CMD)

    Jan 7, 2014 · You are looking for the sqlcmd utility lets you enter Transact-SQL statements, system procedures, and script files at the command prompt sqlcmd -U myLogin -P myPassword -S MyServerName -d MyDatabaseName -Q "query"

  8. Execute SQL script from command line - Stack Overflow

    From your command prompt run sqlcmd /? to get all the options you can use with sqlcmd utility. providing a file name containing all my SQL queries is much more handy than providing the SQL query as command-line arguments. If you use Integrated Security, you might want to know that you simply need to use -E like this:

  9. Executing an SQL Script From the Command Line - Baeldung

    Apr 20, 2024 · Executing .sql scripts in MySQL from the terminal is a very useful tool for database admins and developers. We can use this feature to run large numbers of DB queries from the command line all at once.

  10. MySQL/MariaDB: Run SQL Queries From A Shell Prompt / …

    Sep 9, 2015 · H ow do I specify or run MySQL or MariaDB SQL queries on the UNIX or Linux command line? The mysql command line has option to execute the SQL statement and quit. This is also useful for running sql queries from a shell script or the bash prompt.

  11. Some results have been removed
Refresh