Primary index issue

This is a discussion on Primary index issue within the MySQL Database forums, part of the Database Forums category; Hi, With Mysql databases Is there a way around the situation where, unlike other databases mysql will not allow a ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-23-2007
Robbo
 
Posts: n/a
Default Primary index issue

Hi,

With Mysql databases Is there a way around the situation where, unlike
other databases mysql will not allow a primary 2 field index without
each field being unique ? I'm used to paradox where the combined
fields have to be unique i.e.


partno supplier
ERR3340 MAIN
ERR3340 ALLM
ERR3340 BORD
ERR3340 PREM

TIA

Reply With Quote
  #2 (permalink)  
Old 07-23-2007
Captain Paralytic
 
Posts: n/a
Default Re: Primary index issue

On 23 Jul, 13:33, Robbo <i...@fds7.com> wrote:
> Hi,
>
> With Mysql databases Is there a way around the situation where, unlike
> other databases mysql will not allow a primary 2 field index without
> each field being unique ? I'm used to paradox where the combined
> fields have to be unique i.e.
>
> partno supplier
> ERR3340 MAIN
> ERR3340 ALLM
> ERR3340 BORD
> ERR3340 PREM
>
> TIA


Mysql only requires the combined fields to be unique.

Reply With Quote
  #3 (permalink)  
Old 07-24-2007
Robbo
 
Posts: n/a
Default Re: Primary index issue

On Jul 23, 1:53 pm, Captain Paralytic <paul_laut...@yahoo.com> wrote:
> On 23 Jul, 13:33, Robbo <i...@fds7.com> wrote:
>
> > Hi,

>
> > With Mysql databases Is there a way around the situation where, unlike
> > other databases mysql will not allow a primary 2 field index without
> > each field being unique ? I'm used to paradox where the combined
> > fields have to be unique i.e.

>
> > partno supplier
> > ERR3340 MAIN
> > ERR3340 ALLM
> > ERR3340 BORD
> > ERR3340 PREM

>
> > TIA

>
> Mysql only requires the combined fields to be unique.



I ommited to show in the above example that certain supplier fileds
can be null. That said the combination of the 2 field can and still
should be unqiue within the dataset e.g.

The full table is as follows

partno supplier part_id

ABC123 ABC0010110
GFE187 ABC0010110
ERR3340 MAIN ABC0010110
ERR3340 ALLM ABC0010110
ERR3340 BORD ABC0010110
ERR3340 PREM ABC0010110


The part_id is a field that links all superseeded (connected or
linked) parts. The fact that the supplier field is null is that that
partno has been sup[erseeded to one of the other ones connected by the
part_id field.

In this case I get an error when trying to create the index

MySQL said:

#1171 - All parts of a PRIMARY KEY must be NOT NULL; If you need NULL
in a key, use UNIQUE instead

Does this mean that I have to poulate the blank supplier fields with
say "SUPER" ?

TIA

Reply With Quote
  #4 (permalink)  
Old 07-24-2007
Captain Paralytic
 
Posts: n/a
Default Re: Primary index issue

On 24 Jul, 09:48, Robbo <i...@fds7.com> wrote:
> On Jul 23, 1:53 pm, Captain Paralytic <paul_laut...@yahoo.com> wrote:
>
>
>
>
>
> > On 23 Jul, 13:33, Robbo <i...@fds7.com> wrote:

>
> > > Hi,

>
> > > With Mysql databases Is there a way around the situation where, unlike
> > > other databases mysql will not allow a primary 2 field index without
> > > each field being unique ? I'm used to paradox where the combined
> > > fields have to be unique i.e.

>
> > > partno supplier
> > > ERR3340 MAIN
> > > ERR3340 ALLM
> > > ERR3340 BORD
> > > ERR3340 PREM

>
> > > TIA

>
> > Mysql only requires the combined fields to be unique.

>
> I ommited to show in the above example that certain supplier fileds
> can be null. That said the combination of the 2 field can and still
> should be unqiue within the dataset e.g.
>
> The full table is as follows
>
> partno supplier part_id
>
> ABC123 ABC0010110
> GFE187 ABC0010110
> ERR3340 MAIN ABC0010110
> ERR3340 ALLM ABC0010110
> ERR3340 BORD ABC0010110
> ERR3340 PREM ABC0010110
>
> The part_id is a field that links all superseeded (connected or
> linked) parts. The fact that the supplier field is null is that that
> partno has been sup[erseeded to one of the other ones connected by the
> part_id field.
>
> In this case I get an error when trying to create the index
>
> MySQL said:
>
> #1171 - All parts of a PRIMARY KEY must be NOT NULL; If you need NULL
> in a key, use UNIQUE instead
>
> Does this mean that I have to poulate the blank supplier fields with
> say "SUPER" ?
>
> TIA- Hide quoted text -
>
> - Show quoted text -


You can populate them with the empty string ''
But you cannot make them NULL

Reply With Quote
  #5 (permalink)  
Old 07-24-2007
Robbo
 
Posts: n/a
Default Re: Primary index issue

On Jul 24, 10:04 am, Captain Paralytic <paul_laut...@yahoo.com> wrote:
> On 24 Jul, 09:48, Robbo <i...@fds7.com> wrote:
>
>
>
>
>
> > On Jul 23, 1:53 pm, Captain Paralytic <paul_laut...@yahoo.com> wrote:

>
> > > On 23 Jul, 13:33, Robbo <i...@fds7.com> wrote:

>
> > > > Hi,

>
> > > > With Mysql databases Is there a way around the situation where, unlike
> > > > other databases mysql will not allow a primary 2 field index without
> > > > each field being unique ? I'm used to paradox where the combined
> > > > fields have to be unique i.e.

>
> > > > partno supplier
> > > > ERR3340 MAIN
> > > > ERR3340 ALLM
> > > > ERR3340 BORD
> > > > ERR3340 PREM

>
> > > > TIA

>
> > > Mysql only requires the combined fields to be unique.

>
> > I ommited to show in the above example that certain supplier fileds
> > can be null. That said the combination of the 2 field can and still
> > should be unqiue within the dataset e.g.

>
> > The full table is as follows

>
> > partno supplier part_id

>
> > ABC123 ABC0010110
> > GFE187 ABC0010110
> > ERR3340 MAIN ABC0010110
> > ERR3340 ALLM ABC0010110
> > ERR3340 BORD ABC0010110
> > ERR3340 PREM ABC0010110

>
> > The part_id is a field that links all superseeded (connected or
> > linked) parts. The fact that the supplier field is null is that that
> > partno has been sup[erseeded to one of the other ones connected by the
> > part_id field.

>
> > In this case I get an error when trying to create the index

>
> > MySQL said:

>
> > #1171 - All parts of a PRIMARY KEY must be NOT NULL; If you need NULL
> > in a key, use UNIQUE instead

>
> > Does this mean that I have to poulate the blank supplier fields with
> > say "SUPER" ?

>
> > TIA- Hide quoted text -

>
> > - Show quoted text -

>
> You can populate them with the empty string ''
> But you cannot make them NULL- Hide quoted text -
>
> - Show quoted text -



Ahhh! Thanks very much. I had wrongly assumed they were the same !
doh!

Reply With Quote
  #6 (permalink)  
Old 07-24-2007
Captain Paralytic
 
Posts: n/a
Default Re: Primary index issue

On 24 Jul, 10:16, Robbo <i...@fds7.com> wrote:
> On Jul 24, 10:04 am, Captain Paralytic <paul_laut...@yahoo.com> wrote:
>
>
>
>
>
> > On 24 Jul, 09:48, Robbo <i...@fds7.com> wrote:

>
> > > On Jul 23, 1:53 pm, Captain Paralytic <paul_laut...@yahoo.com> wrote:

>
> > > > On 23 Jul, 13:33, Robbo <i...@fds7.com> wrote:

>
> > > > > Hi,

>
> > > > > With Mysql databases Is there a way around the situation where, unlike
> > > > > other databases mysql will not allow a primary 2 field index without
> > > > > each field being unique ? I'm used to paradox where the combined
> > > > > fields have to be unique i.e.

>
> > > > > partno supplier
> > > > > ERR3340 MAIN
> > > > > ERR3340 ALLM
> > > > > ERR3340 BORD
> > > > > ERR3340 PREM

>
> > > > > TIA

>
> > > > Mysql only requires the combined fields to be unique.

>
> > > I ommited to show in the above example that certain supplier fileds
> > > can be null. That said the combination of the 2 field can and still
> > > should be unqiue within the dataset e.g.

>
> > > The full table is as follows

>
> > > partno supplier part_id

>
> > > ABC123 ABC0010110
> > > GFE187 ABC0010110
> > > ERR3340 MAIN ABC0010110
> > > ERR3340 ALLM ABC0010110
> > > ERR3340 BORD ABC0010110
> > > ERR3340 PREM ABC0010110

>
> > > The part_id is a field that links all superseeded (connected or
> > > linked) parts. The fact that the supplier field is null is that that
> > > partno has been sup[erseeded to one of the other ones connected by the
> > > part_id field.

>
> > > In this case I get an error when trying to create the index

>
> > > MySQL said:

>
> > > #1171 - All parts of a PRIMARY KEY must be NOT NULL; If you need NULL
> > > in a key, use UNIQUE instead

>
> > > Does this mean that I have to poulate the blank supplier fields with
> > > say "SUPER" ?

>
> > > TIA- Hide quoted text -

>
> > > - Show quoted text -

>
> > You can populate them with the empty string ''
> > But you cannot make them NULL- Hide quoted text -

>
> > - Show quoted text -

>
> Ahhh! Thanks very much. I had wrongly assumed they were the same !
> doh!- Hide quoted text -
>
> - Show quoted text -


I did that once upon a time!

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:33 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0