Jump to content

key as index or constraint


coffeecup

Recommended Posts

server version 5.5.9

 

I would like to achieve an understanding of where i can read more information in the documentation or manual in context of what the word ' key ' is and and how to work with it.

KEY user_id(user_id)
-------------------------------------------------------------------
$query = 'CREATE TABLE orders (
		id INT UNSIGNED NOT NULL AUTO_INCREMENT,
		user_id INT UNSIGNED NOT NULL,
		transaction_id VARCHAR(19) NOT NULL,
		payment_status VARCHAR(15) NOT NULL,
		payment_amount DECIMAL(6.2) UNSIGNED NOT NULL,
		payment_date_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
		PRIMARY KEY(id),
		KEY user_id(user_id) )
		ENGINE=MyISAM DEFAULT CHARSET=utf8 ' ;

 

I do understand that this is not the official MySQL web site.

 

I am led to understand in the making of a table that the designations that are made after the columns are made, are constraints.

 

I consulted the index in MySQL reference manual 5.5 PDF, and looked for the word constraints and found page 26 - 1.8.6 HOW MySQL Deals With Constraints and did read that, and that was in correlation with error`s, rollback and such all. The word key was not discussed as being used in a syntax of :

constraint constraint_name (argument)

 

While in the MySQL 5.5 manual PDF, i also looked for the word key as is all by its self and did look into functions. a dark room.

 

Where do i look in the MySQL manual or any where that has concise information to find the use of key in context of being used here in this example. 

 

Am i miss led to beleive that the designations after the columns are termed constraints.

 

Can any body write a politically correct book with out their own assumptions of what terms are actually called. What is the title of that book !.

 

Thank you.

Link to comment
https://forums.phpfreaks.com/topic/247388-key-as-index-or-constraint/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.