Page 1 of 1

I am a newbie.. please.. tell me what is this.

Posted: Wed Jun 27, 2007 12:44 am
by claws
Hi.. every one.

in a database table. for every field there are 3 options available
1. primary
2. Index
3. Unique.

kindly tell me
1. what does each means??
2.how they differ from each other.??
3. can each of the above 3 be applied to any no. of fileds??
4. for a field can we apply all the 3??

really i am very confused with these...

any links to articles will be appriciated...
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:11. Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.

Some examples of what not to do are ne1, any1 (anyone); u (you); ur (your or you're); 2 (to too); prolly (probably); afaik (as far as I know); etc.

Posted: Wed Jun 27, 2007 2:59 am
by Rovas
They refer to the type of key you want to set for your table. But if you don' t know want a key is hard to explain you here want you should now. Get a good book or search for tutorial design database, table keys, etc. Read them first then if you still have questions put them here.

Posted: Wed Jun 27, 2007 3:50 am
by CoderGoblin
Very quickly...

You can only have 1 primary field and this should be whenever possibly an integer field. This column is both unique and indexed.

Indexed fields are those fields you normally search on (joined to other tables etc). Again it is more efficient to use integers whenever possible. Indexes speed up access to the information contained within as the system knows roughly where each value is quicker. Making all your columns indexed does not speed the information retrieval. You need to make sure only those columns you are searching with are indexed. Indexed columns do not need to be unique.

Uniques fields are those columns where all values must be unique with no repetitions within the same column.

Hope that helps but for more information look up some articles. Google is your friend.

Posted: Wed Jun 27, 2007 11:09 am
by ReverendDexter
I want to drive this point home, though it was brought up already:

If you are totally new to the concepts of primary/foriegn keys, unique fields, and indices, stop whatever you're developing, and either go get a book or take a class in database design. These are not concepts that I would suggest just trying to glean from what you can learn via blind shots with google. Getting a book or class will ensure that you cover *all* of the basics, and don't miss something very important just because you didn't know to search for it.

Posted: Wed Jun 27, 2007 12:06 pm
by Luke
I always recommend a book over internet tutorials / blog articles. There are way too many people out there who think they know what they're talking about, but don't. For example:

Here is how you write a php contact form! :roll:

Code: Select all

<?php echo $_GET['error_msg']; ?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>">
   <input type="text" name="name" value="<?php echo $_POST['name']; ?>">
   <input type="submit" value="submit">
</form>

Posted: Wed Jun 27, 2007 3:25 pm
by superdezign
The Ninja Space Goat wrote:I always recommend a book over internet tutorials / blog articles. There are way too many people out there who think they know what they're talking about, but don't. For example:

Here is how you write a php contact form! :roll:

Code: Select all

<?php echo $_GET['error_msg']; ?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>">
   <input type="text" name="name" value="<?php echo $_POST['name']; ?>">
   <input type="submit" value="submit">
</form>
Hehe. Thank God for the forums, or they'd never have anyone to tell them.