* Script for mysql by RPF creates customers table for CAP database in 'futrelle' database and loads csv data into it. Note that the CSV files (comma-separated values) are grabbed from the ONeils' book site. Assume that the following script is in a file futrelle1.sql. Note that comments in SQL scripts use the C convention: /* . */. The examples below were done on my MacBook. In the same way, I'll work with a database named futrelle, my CCIS login name. Its name is your login name and it is already created for you. Using a script to create and load a set of tables: I will assume that the database already exists - on the CCIS CGI Server, only a single database exist. All the examples are called "queries", that is, they are all SQL commands sent at the mysql prompt (or from the MySQL Query Browser). The examples below are all based on the CAP database, the primary example used in the O'Neils' textbook. In fact, LOAD in fact, could be called from within a script. LOAD is only used in loading a table with data from an external file, typically only when setting up the database. Scripts are used a lot and are handy for repetitive tasks, debugging (just edit the script). Instead, I'll just give examples of its use in simple situations. I have not included a lengthy discussion of the LOAD command. At the end of this page I've appended a text version of the relevant sections from the MySQL Reference Manual. The examples here are all standard MySQL, so they should run at the mysql prompt on any platform, or in the MySQL Query Browser you can install. We also describe how to load data from a comma-separated file using the LOAD command. This means executing SQL commands that are contained in a text file, a script. This page will explain how to use MySQL in batch mode. Using MySQL in batch mode - CSU430 Database Design - Fall 2007 Using MySQL in batch mode - CSU430 Database Design - Fall 2007 Professor Futrelle - College of Computer & Information Science, Northeastern U., Boston, MA Version of 2 September 2007
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |