How to Write Accurate SQL Code
SQL is full of difficulties and traps for the unwary. Understanding relational theory is essential for avoiding those traps, but you need to know how to map the ideas of that theory into SQL code. In SQL and Relational Theory, author C.J. Date demonstrates how you can apply relational theory directly to your use of SQL. The second edition includes updated material such as recursive queries, new operators, and extended discussion of topics including aggregate operators, grouping and ungrouping, and view updating. With numerous examples, exercises, and clear explanations, you'll learn how to deal with common SQL dilemmas, such as:
* Why is proper column naming so important?
* Nulls in your database are causing you to get wrong answers. Why? What can you do about it?
* Could you write an SQL query to find employees who have never been in the same department for more than six months at a time?
* SQL supports "quantified comparisons," but they're better avoided. Why? How do you avoid them?
* Constraints are crucially important, but most SQL products don't support them properly. What can you do to resolve this situation?
SQL and Relational Theory draws on decades of research to present the most up-to-date treatment of the material available anywhere. Anyone with a modest to advanced background in SQL will benefit from the many insights in this book.