vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   MySQL Differences... (https://vborg.vbsupport.ru/showthread.php?t=107882)

Bhuwan 02-13-2006 03:18 PM

MySQL Differences...
 
difference beween

UNIQUE KEY
PRIMARY KEY
and a regular
KEY

Xenon 02-13-2006 03:55 PM

there can only be ONE primary key, it's usually the id key.
normally the datablocks are stored in order to this key (if you have an autoindex for example)

unique key means, that every value is there only once, no two rows can have the same unique key (for example username of the usertable)

each primary key is a unique key, but not every unique key is a primary of course

Paul M 02-13-2006 04:01 PM

and a regular key is an index key that does not have to be unique.

Xenon 02-13-2006 04:14 PM

unfortunatelly the name is badchosen, as an index is not really a key.

regarding databasetheory, a key has to identify a single row. and a normal key in mysql doesn't identify.

so if you hear a someone talking about a key in the theoretical aspect, he always means a unique key ;)

Bhuwan 02-13-2006 05:36 PM

Thanks everyone!
So the difference between a PRIMARY KEY and a UNIQUE KEY is that a UNIQUE key can be NULL and a PRIMARY KEY cannot be NULL?

Xenon 02-13-2006 10:16 PM

short said: yes ^^


All times are GMT. The time now is 03:52 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01013 seconds
  • Memory Usage 1,709KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete