Thread: Databases
View Single Post
Old 06-26-2009, 08:26 AM   #5 (permalink)
kieransimkin
Contributing Member
 
Join Date: 06-25-09
Location: Brighton, UK
Posts: 113
iTrader: 0 / 0%
kieransimkin is liked by somebodykieransimkin is liked by somebodykieransimkin is liked by somebody
When I'm designing a database, I often prototype them in a text editor before even touching a real database server, so I just end up with a text file containing a bunch of SQL statements like this:

Code:
CREATE table foo ( id int(32) not null auto_increment, field1 varchar(255) not null, field2 varchar(255) not null, primary key(id), index (field1) ) TYPE=INNODB; CREATE table bar ( id int(32) not null auto_increment, field3 varchar(255) not null, field4 varchar(255) not null, primary key (id) ) TYPE=INNODB; insert into foo set field1='value1', field2='value2'; insert into bar set field3='value3', field4='value4';
Etc etc.

I find this to be a straightforward way to design how my database is laid out - I often write the entire database in this way and then simply copy and paste the SQL into PhpMyAdmin. This way you also have a script for recreating the database from scratch which can come in very handy when testing.

Last edited by kieransimkin; 06-26-2009 at 08:27 AM.. Reason: adding code tags
kieransimkin is offline   Reply With Quote