Are you sure you're using Django? This SQL statement does not look like something django would have emitted. Perhaps your query is best taken to the support community for the database you're using. Our advice here may not be relevant to you.
The issue you're having is what the South package is designed to solve. South will want to see your model before you added the foreign key, but once you initialise it in that state, it will handle that for you. To answer the specific questions (because I'm nice): 'distfk' is just a name for the constraint. It can be anything, really. The first 'address' is the column in the distributors table. The 'addresses(address)' refers to the address column in the 'addresses' table. 'MATCH FULL' is the type of uniqueness constraint you're putting in place. You should check the manual for the database for details. (looks like MySQL?) On Thursday, December 13, 2012 4:53:25 AM UTC-8, laxglx wrote: > > Can anybody plz tell me how to add a foreign key an existing table using > SQL Queries? > >> I got the command, nut can't understand > > ALTER TABLE distributors ADD CONSTRAINT distfk FOREIGN KEY (address) > REFERENCES addresses (address) MATCH FULL; > > > What's "distfk" here if it is key name what is (address) ? and what is > addresses(address)? > And What does mean Match Full > > > Thanks in advance > laxglx > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/PDYq4XIh4BoJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.