Is there such a thing as Design Patterns in SQL ???
+4
A:
A design pattern is simply a recognised way of solving a problem that works in different specific circumstances. Do such things exist in SQL? Of course - for example implementing many to many relationships between two tables using a third table.
anon
2010-05-06 19:16:16
+3
A:
You may want to look at database normalization which is some sort of general Design Pattern in SQL.
neo
2010-05-06 19:16:41
There is also a SQL 'anti-pattern' book coming soon.http://www.pragprog.com/titles/bksqla/sql-antipatterns
Eno
2010-05-06 19:31:37
And I've looked at two chapters of said book, and at this point, it's got some magnificent errors in it. The following from the book is supposed to fetch a random row from a table in Oracle, and it's got two showstopper errors in it: $offset = $pdo->query("SELECT dbms_random.value(1, (SELECT COUNT(*) FROM Bugs) AS offset FROM dual)")->fetch(); $stmt = $pdo->prepare("SELECT * FROM Bugs WHERE ROWNUM = :offset" ); $stmt->execute( $offset ); $rand_bug = $stmt->fetch();
Adam Musch
2010-05-07 15:13:47
+4
A:
Yes. :)
SQL Design Patterns: Expert Guide to SQL Programming
(Not even sure if this is a recommended book.. just illustrating that "proper design" exists).
08Hawkeye
2010-05-06 19:20:55
I live in a universe of "improper design" in both the host side(.NET) and database side(MS SQL SERVER). I am just wondering if I will ever get to work in an evironement where fellow programmers DON'T take pride in shunning books and "GETTING THE JOB DONE".
Berlioz
2010-05-06 20:28:22
You and me both my man. We are constantly balancing results vs. good OO code. Seems like one or the other always has to suffer...
08Hawkeye
2010-05-06 21:14:18