table1
bookid bookname author
0 No book no author
1 Engg Maths Greiwal
2 Java Basics James Gosling
3 Mahabharata Ved Vyasa
4 Ramayana Valmiki
5 Harry Potter JK Rowling
table2
userid name bookid
1 Arjun 2
2 Charles 2
3 Babbage 3
Am having table1 and table2. In the table1 bookid is primary key and the table2 bookid is foreign key. I want to set table2 bookid default value to 0.
Is there any possibilities? We tried with default value as zero.
It throws an exceptions "Cannot add or update child row: a foreign key constaint fails"