This is not true for Oracle either.
A foreign key can certainly reference a unique (not primary) key in
Oracle.
See Oracle documentation, e.g.
http://download.oracle.com/docs/cd/B28359_01/server.111/b28318/data_int.htm#sthref2329,
or simply verify by trying it !
-- PeterN
On May 16, 6:04 pm, Jo
2009/5/16 :
>
> Hi All,
>
> Need help in creating foreign key column in a table.
>
> In the below model I would like to create a foreign key for the field
> 'new_foreign_col' which should refer to 'username' column (non primary
> column) from auth_user table.
>
> class details(models.Model):
>
"I apologize" that is
On May 16, 3:04 pm, Joshua Russo wrote:
> Ok, apologize. I just tried it myself and MySQL did accept the alter
> table. It is certainly not an operation that I have been able to
> perform in MS SQL Server or Oracle, though I wonder if it's something
> that is changing indus
Ok, apologize. I just tried it myself and MySQL did accept the alter
table. It is certainly not an operation that I have been able to
perform in MS SQL Server or Oracle, though I wonder if it's something
that is changing industry wide. MySQL seems to allow a foreign key to
any unique index.
> Thi
On Sat, May 16, 2009 at 10:03 AM, Joshua Russo wrote:
>
> I should probably explain that better. Inside the DB foreign keys can
> only be made between a field in a child/related table to a primary key
> field. Generally the primary key fields don't change as often, though
> you can change them jus
I should probably explain that better. Inside the DB foreign keys can
only be made between a field in a child/related table to a primary key
field. Generally the primary key fields don't change as often, though
you can change them just like any other field it's highly
unrecommended.
If you try to
You want to link to the id field in the auth_user table. Try the
following:
from django.contrib.auth.models import User
class details(models.Model):
user = models.ForeignKey(User)
On May 16, 1:38 pm, lokeshmarema...@gmail.com wrote:
> Hi joshua,
>
> Yes, I just want to link username to deta
Hi joshua,
Yes, I just want to link username to details table.
Regards,
Lokesh
On May 16, 7:30 pm, Joshua Russo wrote:
> Foreign keys only point to primary key values. That's just how
> relational DBs work
>
> It looks like you just want to link details to a user. Is that
> correct?
>
> On May
Foreign keys only point to primary key values. That's just how
relational DBs work.
It looks like you just want to link details to a user. Is that
correct?
On May 16, 12:46 pm, lokeshmarema...@gmail.com wrote:
> Hi All,
>
> Is it possible to create a foreign key to a model referring to a non
>
Hi All,
Need help in creating foreign key column in a table.
In the below model I would like to create a foreign key for the field
'new_foreign_col' which should refer to 'username' column (non primary
column) from auth_user table.
class details(models.Model):
new_foreign_col =
Tha
On Sat, May 16, 2009 at 8:46 AM, wrote:
>
> Hi All,
>
> Is it possible to create a foreign key to a model referring to a non
> primary column from other model.
>
> class details(models.Model):
>username =
>
> ?? -> how I can refer this field as a foreign key to username
> column
Hi All,
Is it possible to create a foreign key to a model referring to a non
primary column from other model.
class details(models.Model):
username =
?? -> how I can refer this field as a foreign key to username
column which is from auth_user table.
Thanks in advance.
Regards
12 matches
Mail list logo