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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.