Created
April 1, 2012 13:57
-
-
Save tedhagos/2275447 to your computer and use it in GitHub Desktop.
MySQL test table creation script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
@date Sun Apr 1 21:18:49 PHT 2012 | |
@author Ted Hagos | |
A simple sql statement that can be used to test out database routines. | |
NOTE: | |
1. The date is inserted using a function of MySQL STR_TO_DATE. It follows US Date format | |
2. Remember that ActiveRecord follows a 'convention' over configuration, hence the way | |
you name the tables will have an impact on the name of the class names in ActiveRecord | |
-- A class named 'User' in ActiveRecord will correspond to a table called 'users' in your | |
database. | |
*/ | |
DROP DATABASE arecordtest; | |
CREATE DATABASE arecordtest; | |
USE arecordtest; | |
CREATE TABLE users( | |
id int NOT NULL AUTO_INCREMENT, | |
lastname VARCHAR(100), | |
firstname VARCHAR(100), | |
middlename VARCHAR(100), | |
emailaddress VARCHAR(150), | |
birthdate DATE, | |
username VARCHAR(100), | |
password VARCHAR(20), | |
PRIMARY KEY(id) | |
); | |
INSERT INTO users(lastname,firstname,middlename,emailaddress,birthdate,username,password) | |
VALUES | |
( | |
'Gosling', | |
'James', | |
'X', | |
'james.gosling@java.com', | |
STR_TO_DATE('12-31-1959','%m-%d-%Y'), | |
'jamesg', | |
'askjava' | |
); | |
INSERT INTO users(lastname,firstname,middlename,emailaddress,birthdate,username,password) | |
VALUES | |
( | |
'Stroustrup', | |
'Bjarne', | |
'M', | |
'bstroustrup@cplusplus.com', | |
STR_TO_DATE('11-15-1949','%m-%d-%Y'), | |
'bs', | |
'askme' | |
); | |
INSERT INTO users(lastname,firstname,middlename,emailaddress,birthdate,username,password) | |
VALUES | |
( | |
'Ritchie', | |
'Dennis', | |
'A', | |
'dmritchie@cee.com', | |
STR_TO_DATE('10-26-1935','%m-%d-%Y'), | |
'dmr', | |
'helloworld' | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment