I am following the To Base and Back Again tutorial series from neowiki. In the Establishing Relationships tutorial, the author creates a Unique Constraint using an SQL statement. By blindly following the instructions, I, too, have created a unique constraint. But I don't know why. I understand a Unique Index.
What does a Unique Constraint do? Why would I want to create one? I have checked the index in SQL for Mortals and it ain't even there, so that's no help.
I searched this part of the forum and although there is one solved post on the subject, the answer doesn't clarify the Why?, only the How?.
Can someone explain the rationale behind Unique Constraint, please? I know I won't die if I don't find out, but I'm sure it'll save me tearing my hair out further down the line.
Thanks
[Solved] Unique Constraint - What Does It Mean?
- LJ Bettona
- Posts: 58
- Joined: Fri Jan 04, 2008 12:31 pm
- Location: Italy
[Solved] Unique Constraint - What Does It Mean?
Last edited by LJ Bettona on Sun Mar 02, 2008 1:04 pm, edited 1 time in total.
iMac G5, OS 10.4.11
OO 2.4, NeoOffice 3 patch 1
OOo 2.2.X on Mac OSx other + Actually NeoOffice 3 patch 1
OO 2.4, NeoOffice 3 patch 1
OOo 2.2.X on Mac OSx other + Actually NeoOffice 3 patch 1
- DrewJensen
- Volunteer
- Posts: 1734
- Joined: Sat Oct 06, 2007 9:01 pm
- Location: Cumberland, MD - USA
Re: Unique Constraint - What Does It Mean?
A unique constraint simply says that every value in that column must be unique.
The most common use of this is when declaring a Primary Key on a table - the key is used to uniquely identify one row of data from all other rows of data. It is possible however and sometimes done to have a unique constraint that is not part of the primary key. One reason to do this is that for most database engine once a column has been designated a primary key it can not be altered, whereas if it simply has a unique constraint the constraint can be removed and the column altered.
One item that is Base specific is that any table that will be updated using GUI data controls must have a primary key.
For all database engines, Base's included, designating a column or columns as the primary key automatically creates a unique constraint - without you needing to do anything further.
The most common use of this is when declaring a Primary Key on a table - the key is used to uniquely identify one row of data from all other rows of data. It is possible however and sometimes done to have a unique constraint that is not part of the primary key. One reason to do this is that for most database engine once a column has been designated a primary key it can not be altered, whereas if it simply has a unique constraint the constraint can be removed and the column altered.
One item that is Base specific is that any table that will be updated using GUI data controls must have a primary key.
For all database engines, Base's included, designating a column or columns as the primary key automatically creates a unique constraint - without you needing to do anything further.
Former member of The Document Foundation
Former member of Apache OpenOffice PMC
LibreOffice on Ubuntu 18.04
Former member of Apache OpenOffice PMC
LibreOffice on Ubuntu 18.04
Re: Unique Constraint - What Does It Mean?
Except for dBase tables? Bibliography.biblio has no primary key and I can update, insert and delete by any means.DrewJensen wrote:One item that is Base specific is that any table that will be updated using GUI data controls must have a primary key.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
- DrewJensen
- Volunteer
- Posts: 1734
- Joined: Sat Oct 06, 2007 9:01 pm
- Location: Cumberland, MD - USA
Re: Unique Constraint - What Does It Mean?
REALLY news to me...but much is..- that should be changed to conform dont you tink...LOL...
Edit: Well what do you know...you're right...hmmm |
Former member of The Document Foundation
Former member of Apache OpenOffice PMC
LibreOffice on Ubuntu 18.04
Former member of Apache OpenOffice PMC
LibreOffice on Ubuntu 18.04
- LJ Bettona
- Posts: 58
- Joined: Fri Jan 04, 2008 12:31 pm
- Location: Italy
Re: Unique Constraint - What Does It Mean?
Maybe I missed something somewhere, but I thought that was what a Unique Index did? So, if I want each album title in my CD database to be unique I should put a Unique Constraint on it, not a Unique Index?A unique constraint simply says that every value in that column must be unique.
Sometimes I ask myself why I couldn't be content with my AppleWorks flat file dbf's? Life was so much simpler then.
Thanks for the responses, guys
iMac G5, OS 10.4.11
OO 2.4, NeoOffice 3 patch 1
OOo 2.2.X on Mac OSx other + Actually NeoOffice 3 patch 1
OO 2.4, NeoOffice 3 patch 1
OOo 2.2.X on Mac OSx other + Actually NeoOffice 3 patch 1
Re: Unique Constraint - What Does It Mean?
This migh help: http://en.wikipedia.org/wiki/Primary_Key
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
- LJ Bettona
- Posts: 58
- Joined: Fri Jan 04, 2008 12:31 pm
- Location: Italy
Re: Solved Unique Constraint - What Does It Mean?
Thanks for all the help. I'll try to make sense of the wiki article
iMac G5, OS 10.4.11
OO 2.4, NeoOffice 3 patch 1
OOo 2.2.X on Mac OSx other + Actually NeoOffice 3 patch 1
OO 2.4, NeoOffice 3 patch 1
OOo 2.2.X on Mac OSx other + Actually NeoOffice 3 patch 1