Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 05-13-2009, 12:38 PM SQL Tables
millwalll's Avatar
Webmaster Talker

Posts: 674
Name: James
Location: KENT
Trades: 3
Hi all I am making some tables and wanted to post code to get someone to make sure they are ok thanks in advance.


Code:
###############
Calendar table
###############
create table calendar
(date datetime,
colour varchar(10) not null,
notes varchar(140) not null,
primary key (date))
engine = innodb;

###############
Booking table
###############
create table booking
booking code not null auto_increment,
date datetime,
price code varchar(10) not null,
booking name varchar(15) not null,
booking cost varchar(10)not null,
primary key (booking code),
foreign key (date) references calendar(date),
foreign key (price code) references price(price code)
engine = innodb;

###############
Booking price
###############
create table price
price code not null auto_increment,
price cost varchar(10) not null,
price description varchar(50) not null,
primary key (price code),
engine = innodb;


###############
Booking picture
###############
create table gallery
(picture code not null auto_increment,
picture name varchar(10) not null,
picture description varchar(50) not null,
primary key picture code),
engine = innodb;
__________________

Please login or register to view this content. Registration is FREE
millwalll is offline
Reply With Quote
View Public Profile Visit millwalll's homepage!
 
 
Register now for full access!
Old 05-13-2009, 01:57 PM Re: SQL Tables
Extreme Talker

Posts: 177
Trades: 0
few things

I dont like to use spaces in field names, cause.... I don't like to use quotes when querying the tables and specifying field names. So honestly to make things easier I would probably use _ instead of spaces, but that's just personal preference.

Everything looks pretty good except your closing statements (before specifying the engine)

calendar table is fine

booking table needed beginnning '(' and ending ')'

same thing with booking price, also had an extra ',' after primary key specification

booking picture needed ',' taking away after primary key declaration and also the closing ')'

The sql code specified below should be accurate.

again, the spaces might cause some issues, i'm not sure though because I've always steered clear of them.

Code:
###############
Calendar table
###############
create table calendar
(date datetime,
colour varchar(10) not null,
notes varchar(140) not null,
primary key (date))
engine = innodb;

###############
Booking table
###############
create table booking (
booking code not null auto_increment,
date datetime,
price code varchar(10) not null,
booking name varchar(15) not null,
booking cost varchar(10)not null,
primary key (booking code),
foreign key (date) references calendar(date),
foreign key (price code) references price(price code)
)
engine = innodb;

###############
Booking price
###############
create table price (
price code not null auto_increment,
price cost varchar(10) not null,
price description varchar(50) not null,
primary key (price code)
)
engine = innodb;


###############
Booking picture
###############
create table gallery
(picture code not null auto_increment,
picture name varchar(10) not null,
picture description varchar(50) not null,
primary key (picture code)
)
engine = innodb;
kbfirebreather is offline
Reply With Quote
View Public Profile
 
Old 05-13-2009, 02:25 PM Re: SQL Tables
millwalll's Avatar
Webmaster Talker

Posts: 674
Name: James
Location: KENT
Trades: 3
thanks
__________________

Please login or register to view this content. Registration is FREE
millwalll is offline
Reply With Quote
View Public Profile Visit millwalll's homepage!
 
Old 05-13-2009, 03:51 PM Re: SQL Tables
Extreme Talker

Posts: 177
Trades: 0
Your very welcome, did the execution of the tables have any issues?
kbfirebreather is offline
Reply With Quote
View Public Profile
 
Old 05-14-2009, 06:15 AM Re: SQL Tables
millwalll's Avatar
Webmaster Talker

Posts: 674
Name: James
Location: KENT
Trades: 3
have not tried them yet
__________________

Please login or register to view this content. Registration is FREE
millwalll is offline
Reply With Quote
View Public Profile Visit millwalll's homepage!
 
Reply     « Reply to SQL Tables
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.20658 seconds with 12 queries