Mysql: How to call sql script file from other sql script file?

Problem :

Suppose I have wrote script Table_ABC.sql which creates table ABC. I have created many such scripts for each of required tables. Now i want to write a script that call all of these script files in a sequence so basically I want another script file createTables.sql. Mysql provides option to execute a script file from "mysql" shell application but could find some command like exec c:/myscripts/mytable.sql. Please tell me if there is any command that can be written in sql script itself to call other one in latest mysql versions or alternative for same.


Solution :

You can use source command. So your script will be something like:

use your_db;
source script/s1.sql;
source script/s2.sql;
-- so on, so forth

Mysql Tutorials

Mysql Howto..

how to join three or more tables in mysql

How to resolve “isn't in GROUP BY” error in mysql query

How to update mysql table without deleting existing content

How to break insert query, before insert trigger mysql

How to update MYSQL field without refreshing page in PHP?

How to change this mysql select into sql server select statement?

MySQL - How to SELECT based on value of another SELECT

How to improve an IF statement in MySQL?

MySQL - How do I to select data from a table, ordering by the difference between the values of two columns?

How to change data type when running query (not inside PHP)

How do I make a script that converts a Comma Separated text file .csv to mysql database field? [closed]

How can I simulate a peer-to-peer communications channel using PHP, MySQL DB and JavaScript?

How to populate gridview with mysql?

How to specify the quote to use for strings in a python list for mysql?

How to Pickle a python dictionary into MySQL?

How to Display result of subquery rows as one column in MySQL?

How to automatically subtract or add data from columns in mysql

mySQL: how to update table and fields dependent on values in other tables?

How to prevent, counter or compensate for, an empty/NULL field (MySQL) returning an empty set

How to use case sensitivity in instr() in MySQL?

How to correctly install MySQL Ruby Gem

Convert Date to a number in mysql (Like how a date converts in Excel)

How to install MySQLdb on Mountain Lion

MySQL how to make value expire?

MySQL - How to index this query?

How do I use MySQL transactions in PHP?

How To Get table columns with some condition in MYSQL? [closed]

How to query to get the Max value of a field in relating to another field? Group By Doesn't work? (MySQL)

How to restore same database when switching branch?

SQL returning values - how to do it? [closed]