Showing posts with label foreign key in mysql. Show all posts
Showing posts with label foreign key in mysql. Show all posts

Friday 20 June 2014

what is foreign key in Mysql ?


what is foreign key in Mysql ?

Foreign key is used to establish the relationship among the tables. Foreign key type can be primary key, unique key or normal key of its table.suppose you want to manage data of authors and their books in the database. For this you have a table name "author". The author table has columns like "author_id", "author_name" to store authors info. To store books you have another table named "books". The books has columns like "book_id","book_name" and "author_id".

Here "author_id" is foreign key....