Reputation: 568
For my database class the teacher assigned us to use Oracle SQL to design an application. Because I have more experience with mySQL he said I could use it instead.
I want to make my assignment look as simliar to his example as possible. What his example consists of of is one file run.sql that looks like this:
@start //this runs start.sql which creates the tables
DESC table_name; //do this for all tables
@insert //this runs insert.sql that creates dummy data
SELECT * FROM table_name; //do this for all tables
@query //this runs query.sql that runs our sample queries
@drop //this kills all the data
Is there a way to do something simliar?
Namely a way to write a query that calls external queries and outputs all data to an output.txt file?
Upvotes: 0
Views: 83
Reputation: 90
Use 'source' to input the *.sql files
use 'create procedure' to generate the 'drop' function
use "into outfile '/file/path';" on your select to write out.
double redirect to append: "into outfile '>>/file/path';"
Upvotes: 1
Reputation: 211560
The source
command for the mysql
command-line client could do the job here:
source start.sql;
DESC table_name;
You can get more commands with help
.
Upvotes: 0