我目前正在制作一个关于主外键关系的表格......
book table
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
usertable
userid name bookid
1 Arjun 2
2 Charles 2
3 Babbage 3
这里 bookid 是 usertable 中的外键,也是 booktable 中的主键......现在我听说了级联、 setnull 、restrict 和无操作约束......
0 设置为 usertable 中 bookid 列的默认值.....
Now i want a situation when a bookid(primary) entry is deleted from the main table i.e booktable, the entires containing bookid in the user table should be updated to the default value ( i.e here 0 ).....
有没有什么方法……???
我只能说我正在研究 phpmyadmin mysql innodb ......