On Sun, 10 Nov 2013 14:54:17 +0400 dd <durga.d...@gmail.com> wrote: > After applying normalization, there are twelve tables with foreign > key support.
Well done. > For insert/delete operations, it has to execute twelve queries > instead of two. Is it recommended way? Yes. In a user-defined transaction. Each INSERT affects only one table; there is no single SQL operation to insert into several tables at once. Tutorial D, mentioned elsewhere in this thread, has much the same limit, except that it uses a comma to join operations into one giant do-these-together operation. Other DBMSs use stored procedures to collect together SQL needed to act a on a related set of tables. The idea that N tables explicitly related by foreign keys could be operated on as a (possibly named) set with a single operation is interesting. I don't know of any literature on the subject, not that it would be hard to miss. > In delete case, do always need to check in parent table whether > child key refers to any other rows in parent table? Yes. Do that with a correlated subquery, though, not by preceding DELETE with SELECT count(*). --jkl _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users