Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old June 29th, 2004, 02:50 PM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your message. I always thought if we create a PK-FK, relation it speeds up the queery when we join two tables in a queery..is this not true? because like you said Foreign key will slow down the speed.

I wonder that why then we create a PK-FK relation then.
Thanks



Reply With Quote
  #12 (permalink)  
Old June 30th, 2004, 05:19 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The advantage of creating the reltionship, is that it enforces the external logic about the system that the data represents. The dowside, is that anything like this inevitably slows things down, because it requires the database manager to check the things you have stipulated to it before blindly carrying out the actions you request.

This applies to any constraint you apply to your data. For a simpler example, we could, if we wanted, store all the results of a question which has a simple "Yes" or "No" answer in a field of type char (storing either 'Y' or 'N', respectively). It makes more sense, however, to store it in a field of type ENUM('Y', 'N'), or even ENUM 'Yes', 'No'), since a char field will quite happily take a value of 'G' or '$', or any other member of the ASCII characterset without complaining. The penalty is, that the database manager must check what is being given and ensure that it is either a 'Y' or a 'N', before inserting it. This penaly is so vanishingly small, however, that it simply isn't worth dispansing with the ENUM field type.

At a more complex level, it would be much quicker to store all data that you search very frequently on the basis of its date and time values by using UNIX timestamps for all the date and time values in fields of type INT (inserting and retrieving them via the UNIX_TIMESTAMP and FROM_UNIXTIME functions). However, to do so would mean losing MySQL's impressive battery of Date and time-handling functions, as well as causing all your date and time data to become essentially unreadable as date and time data. Any such implementation would therefore be almost worthless since Unix timestamp is one of the date and time formate which MySQL doesn't natively support. The time penalty incurred in using the programmed-in intelligence of the database manager is almost always less than the penalty of storing dates as values which differ from on another by - I think it's something like 84,600 seconds, but I can't be bothered doing the calculation - I'm sure you get my drift... :)

Likewise, the use of foreign keys enforces the external logic of what your data is ment to represent in the real world, and prevents illogical things being done, or the accumulation of redundant data (as an example, it stops you deleting an organiser for an event until you first delete the event, for instance, since your design stipulates that an event without an organiser would throw as major a spanner in the external logic of your application, as would a test for "has this event been deleted?" getting a response of "$").

Take it easy
Dan
Reply With Quote
  #13 (permalink)  
Old July 3rd, 2004, 10:54 AM
Authorized User
 
Join Date: Feb 2004
Location: london, uk, United Kingdom.
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default

what i suggest is try installing phpmyadmin this is the link
http://prdownloads.sourceforge.net/p...2.zip?download
but before you should install php on your server. advantage of phpmyadmin is it's moreeasier to work around mysql and mush easier at least i am kind on new to php and mysql but using phpmyadmin will make it more easier for you

Best Regards,
Hamed Gholamian
Reply With Quote
  #14 (permalink)  
Old July 5th, 2004, 08:15 AM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks, i downloaded phpadmin from that link, and unzipped file, but i don't see any executable file in the folders to launch and install phpadmin.

Reply With Quote
  #15 (permalink)  
Old July 5th, 2004, 10:22 AM
Authorized User
 
Join Date: Feb 2004
Location: london, uk, United Kingdom.
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Follow this and i can promise you won't have any problem
1- Unzip it into a folder(phpmyadmin)
2- Then right click on that folder and select sharing.(new window will open)
3- From there choose web sharing
4- Select web sharing and in the alias box enter the name(best name is phpmyadmin)and click on ok and ok again.
5- Now goto to your iis manager(i am assuming you have php installed already if not download it from this link http://uk2.php.net/get/php-4.3.7-ins.../from/a/mirror)
6- When you open your iis you should see phpmyadmin
7- Right click on phpmyadmin folder(in your iis manager) and select properties.
8- Select Documents
9- Select add and on Default Document name type this index.php and click on ok
close this windows
10- Again right click on phpmyadmin folder and this time choose browse
11- you should see the phpmyamin page now.(you might need to click on phpmyadmin folder in your iis manager and from there find index.php and right click on that file and select browse if you see blank page)

and thats it if you have problem email me and i will provide you with images


Best Regards,
Hamed Gholamian
Reply With Quote
  #16 (permalink)  
Old July 6th, 2004, 10:46 AM
Authorized User
 
Join Date: Feb 2004
Location: london, uk, United Kingdom.
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I hope you are ok now please let me know what happened

Best Regards,
Hamed Gholamian
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
creating database application ruslaim VB Databases Basics 3 November 21st, 2007 10:25 PM
problem: Creating the Example Database dcr BOOK: Beginning SQL 1 October 11th, 2007 07:56 AM
creating a database kcrist84 VB Databases Basics 3 July 20th, 2007 03:35 PM
Creating New Database everest SQL Server 2005 2 July 10th, 2007 01:32 PM
Problem creating drinks control database Odeh Naber Access VBA 5 August 5th, 2006 09:33 AM



All times are GMT -4. The time now is 01:29 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.