Permalink
Browse files

added script to load data files into MySQL

  • Loading branch information...
1 parent 8f1cd6c commit 3cf156e55e0d1443c75931d7e8b3bb8a92435bdb Greg Rahn committed Jun 17, 2011
Showing with 26 additions and 0 deletions.
  1. +26 −0 load_data.sql
View
@@ -0,0 +1,26 @@
+-- script for MySQL
+
+drop table sessions;
+drop table votes;
+drop table users;
+
+create table sessions (
+session_id int primary key,
+title varchar(100),
+user_id int
+);
+
+create table votes (
+id integer primary key auto_increment,
+session_id int,
+user_id int
+);
+
+create table users (
+user_id int primary key,
+name varchar(100)
+);
+
+LOAD DATA LOCAL INFILE 'sessions.dat' INTO TABLE sessions FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"';
+LOAD DATA LOCAL INFILE 'votes.dat' INTO TABLE votes FIELDS TERMINATED BY '|' (session_id, user_id);
+LOAD DATA LOCAL INFILE 'users.dat' INTO TABLE users FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"';

0 comments on commit 3cf156e

Please sign in to comment.