<== Back
The Script File
1. Open notepad and type your query.
2. Save it as "my.sql" (or whatever .sql)
3. Go into mysql
4. Select a database
5. type "source my.sql"
You can use this to write and refine select (or any kind of) sql statements.
You can also put things like "use bank;" inside of this script file so that as soon as you start
MySQL you can just run the script file and it will automatically choose the database for you
and do what you want it to do. This greatly simplifies things for you.
Here is an example script file for creating a table in the "bank" database:
Here is an example of a select statement:
Here is an example of an insert statement:
For the insert statement, you can copy and paste and change the insert statement as many times as
you want in the same script file.
You can also specify a path to the source file by typing "source c:\path\path" replacing path with
the path to your file...
To delete everything in a table without deleting a table just say "delete from people" (or whatever
your table name is).
<== Back