對於我的數據庫類,教師指派我們使用Oracle SQL來設計應用程序。因爲我對mySQL有更多的經驗,他說我可以用它來代替。從腳本運行mySQL查詢
我想讓我的任務看起來像他的例子一樣。他有什麼例子包含的是一個文件run.sql看起來像這樣:
@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
有沒有辦法做一些事情simliar?
即是寫一個調用外部查詢並將所有數據輸出到output.txt文件的查詢的方法?
有沒有辦法做這樣的事情? SOURCE run.sql INTO OUTFILE'output.txt'; – dspiegs 2013-05-01 03:42:10
我發現這個工程:mysql -p dbname < foo.sql > foo.txt但不包含所有輸出或漂亮打印。 – dspiegs 2013-05-01 03:48:54