dbTalk Databases Forums  

About indexes in tables.

comp.databases.mysql comp.databases.mysql


Discuss About indexes in tables. in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
SpreadTooThin
 
Posts: n/a

Default About indexes in tables. - 10-29-2010 , 08:46 PM






I have a table where two or more columns together must be unique.

How tell mysql that col-a + col-b must be unique in a row?


How do you spell indecies???

Reply With Quote
  #2  
Old   
Jerry Stuckle
 
Posts: n/a

Default Re: About indexes in tables. - 10-29-2010 , 10:16 PM






On 10/29/2010 9:46 PM, SpreadTooThin wrote:
Quote:
I have a table where two or more columns together must be unique.

How tell mysql that col-a + col-b must be unique in a row?


How do you spell indecies???

Create a unique index on col-a + col-b.

And it can either be indicies or indexes - the latter is more commonly
used, but the former is more proper.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex (AT) attglobal (DOT) net
==================

Reply With Quote
  #3  
Old   
Lennart Jonsson
 
Posts: n/a

Default Re: About indexes in tables. - 10-29-2010 , 11:18 PM



On 2010-10-30 03:46, SpreadTooThin wrote:
Quote:
I have a table where two or more columns together must be unique.

How tell mysql that col-a + col-b must be unique in a row?

You can create a unique constraint as in

alter table t add constraint ... unique (a, b);


/Lennart

Reply With Quote
  #4  
Old   
SpreadTooThin
 
Posts: n/a

Default Re: About indexes in tables. - 10-29-2010 , 11:39 PM



On Oct 29, 10:18*pm, Lennart Jonsson <erik.lennart.jons... (AT) gmail (DOT) com>
wrote:
Quote:
On 2010-10-30 03:46, SpreadTooThin wrote:

I have a table where two or more columns together must be unique.

How tell mysql that col-a + col-b must be unique in a row?

You can create a unique constraint as in

alter table t add constraint ... unique (a, b);

/Lennart
I'm using MySQLWorkbench.
Do I just check the columns I want as primary keys?
Or must it be in the sql script?

Reply With Quote
  #5  
Old   
Lennart Jonsson
 
Posts: n/a

Default Re: About indexes in tables. - 10-30-2010 , 03:18 AM



On 2010-10-30 06:39, SpreadTooThin wrote:
[...]
Quote:
I'm using MySQLWorkbench.
Do I just check the columns I want as primary keys?
Or must it be in the sql script?
I have never used MySQLWorkbench so I have no idea.

There can be several candidate keys in a table, and for reasons unknown
to me, it was decided in sql that one of them should be primary, the
primary key. If there are other candidate keys you can implement them
via unique constraints.

/Lennart

Reply With Quote
  #6  
Old   
Doug Miller
 
Posts: n/a

Default Re: About indexes in tables. - 10-30-2010 , 03:05 PM



In article <iag2n3$uqk$1 (AT) news (DOT) eternal-september.org>, Jerry Stuckle <jstucklex (AT) attglobal (DOT) net> wrote:
Quote:
On 10/29/2010 9:46 PM, SpreadTooThin wrote:
I have a table where two or more columns together must be unique.

How tell mysql that col-a + col-b must be unique in a row?


How do you spell indecies???


Create a unique index on col-a + col-b.

And it can either be indicies or indexes - the latter is more commonly
used, but the former is more proper.
Since when is a misspelled word "more proper" than a correctly spelled one?
The correct spelling is "indices".
>

Reply With Quote
  #7  
Old   
Jerry Stuckle
 
Posts: n/a

Default Re: About indexes in tables. - 10-30-2010 , 03:21 PM



On 10/30/2010 4:05 PM, Doug Miller wrote:
Quote:
In article<iag2n3$uqk$1 (AT) news (DOT) eternal-september.org>, Jerry Stuckle<jstucklex (AT) attglobal (DOT) net> wrote:
On 10/29/2010 9:46 PM, SpreadTooThin wrote:
I have a table where two or more columns together must be unique.

How tell mysql that col-a + col-b must be unique in a row?


How do you spell indecies???


Create a unique index on col-a + col-b.

And it can either be indicies or indexes - the latter is more commonly
used, but the former is more proper.

Since when is a misspelled word "more proper" than a correctly spelled one?
The correct spelling is "indices".

Incorrect. http://dictionary.reference.com/browse/index

Both are acceptable.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex (AT) attglobal (DOT) net
==================

Reply With Quote
  #8  
Old   
Jerry Stuckle
 
Posts: n/a

Default Re: About indexes in tables. - 10-30-2010 , 03:23 PM



On 10/30/2010 4:05 PM, Doug Miller wrote:
Quote:
In article<iag2n3$uqk$1 (AT) news (DOT) eternal-september.org>, Jerry Stuckle<jstucklex (AT) attglobal (DOT) net> wrote:
On 10/29/2010 9:46 PM, SpreadTooThin wrote:
I have a table where two or more columns together must be unique.

How tell mysql that col-a + col-b must be unique in a row?


How do you spell indecies???


Create a unique index on col-a + col-b.

And it can either be indicies or indexes - the latter is more commonly
used, but the former is more proper.

Since when is a misspelled word "more proper" than a correctly spelled one?
The correct spelling is "indices".

OOps - I see now - you are correct - I did get an extra 'e' in there.

I though you were saying indices was incorrect.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex (AT) attglobal (DOT) net
==================

Reply With Quote
  #9  
Old   
Doug Miller
 
Posts: n/a

Default Re: About indexes in tables. - 10-31-2010 , 12:42 PM



In article <iahuol$gfp$1 (AT) news (DOT) eternal-september.org>, Jerry Stuckle <jstucklex (AT) attglobal (DOT) net> wrote:
Quote:
On 10/30/2010 4:05 PM, Doug Miller wrote:
In article<iag2n3$uqk$1 (AT) news (DOT) eternal-september.org>, Jerry
Stuckle<jstucklex (AT) attglobal (DOT) net> wrote:
On 10/29/2010 9:46 PM, SpreadTooThin wrote:
I have a table where two or more columns together must be unique.

How tell mysql that col-a + col-b must be unique in a row?


How do you spell indecies???


Create a unique index on col-a + col-b.

And it can either be indicies or indexes - the latter is more commonly
used, but the former is more proper.

Since when is a misspelled word "more proper" than a correctly spelled one?
The correct spelling is "indices".


Incorrect. http://dictionary.reference.com/browse/index

Both are acceptable.

Wrong again. "Indicies" is not an acceptable spelling for anything.

Reply With Quote
  #10  
Old   
The Natural Philosopher
 
Posts: n/a

Default Re: About indexes in tables. - 10-31-2010 , 02:08 PM



Doug Miller wrote:
Quote:
In article <iahuol$gfp$1 (AT) news (DOT) eternal-september.org>, Jerry Stuckle <jstucklex (AT) attglobal (DOT) net> wrote:
On 10/30/2010 4:05 PM, Doug Miller wrote:
In article<iag2n3$uqk$1 (AT) news (DOT) eternal-september.org>, Jerry
Stuckle<jstucklex (AT) attglobal (DOT) net> wrote:
On 10/29/2010 9:46 PM, SpreadTooThin wrote:
I have a table where two or more columns together must be unique.

How tell mysql that col-a + col-b must be unique in a row?


How do you spell indecies???

Create a unique index on col-a + col-b.

And it can either be indicies or indexes - the latter is more commonly
used, but the former is more proper.
Since when is a misspelled word "more proper" than a correctly spelled one?
The correct spelling is "indices".
Incorrect. http://dictionary.reference.com/browse/index

Both are acceptable.

Wrong again. "Indicies" is not an acceptable spelling for anything.
Well it would be the plural of indicius. IIRC. But I probably don't.
Latin was a long time ago, and not that interesting.

Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.