Currently I am using Vertica on Ubuntu 14.04 from the terminal as dbadmin. I am using 'admintools' to connect a database and then executing queries like Create Table, Select, Insert in the terminal.
Is there any way I can write the commands in any external text file and execute all the query at once? Like for Oracle, We can create a SQL file in Notepad++ and then run all the queries in the database.
Not only can you use scripts, but it's a good practice for any operation that you might need to repeat.
From the vsql prompt, use [the \i command](https://my.vertica.com/docs/8.1.x/HTML/index.htm#Authoring/ConnectingToVertica/vsql/Meta-Commands/iFILE.htm) to run a script:
vsql> \i create_tables.sql
From outside the vsql prompt, you can invoke vsql with [-f filename](https://my.vertica.com/docs/8.1.x/HTML/index.htm#Authoring/ConnectingToVertica/vsql/CommandLineOptions/fFilename--fileFilename.htm).
File paths, if not absolute, are relative to the current working directory.