Execute multiple queries from file or directly in the SQL editor

Hi,

I am new to MemSQL. I want to execute multiple statement (around 50-60) at one go.
how should I do it?

I know it is possible in other databases like Oracle, SQL Server using go function.

I have wrote queries like belows in the .sql file:

use ;

DROP TABLE emp;
DROP TABLE dept;

and selecting all above queries and executing it.

Hello pawanbag! :wave: Welcome aboard!

MemSQL is now SingleStore! Yay! And we’re happy to help. Are you running on the managed or self-hosted service and what version number?

Hello pawanbag,

Indeed you can run multiple sql statements from a .sql file as follow :

using the SingleStore Client :

singlestore -h hostname -P portnumber -u db_username -pdb_password -D db_name < queries.sql

Where
hostname : SingleStore Server hosting an aggregator (Master or Child)
portnumber : SingleStore port , default 3306
db_username : username to connect to the database
db_password : password, you can add just -p without password, then you will be prompted to type the password.
db_name : database name to run your queries against.

Regards.

1 Like