How to add Foreign key in a table after the creation of the
table?

Answer Posted / sagar98

ALTER TABLE <table_name>
ADD CONSTRAINT <fk_name> FOREIGN KEY (column_name)
REFERENCES <table_name_where_this_column_acts_as_PK>
(Column_name)

Is This Answer Correct ?    19 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is rank () in sql?

697


List and explain the different types of join clauses supported in ansi-standard sql?

1030


what is a stored procedure? : Sql dba

783


What is a primary key example?

695


What is record variable?

708






How many joins in sql?

736


Is join same as left join?

753


How do I truncate a sql log file?

741


what is the difference between group by and order by in sql? : Sql dba

765


Does varchar need length?

712


What is a composite primary key?

767


what is a trigger in mysql? : Sql dba

786


How can the performance of a trigger be improved?

774


what are the 'mysql' command line arguments? : Sql dba

839


Can we join more than 2 tables in sql?

678