本文介绍了如何在SQL中思考?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何停止思考每个查询的游标,程序和函数,并开始使用SQL,因为它应该是?我们是否只是通过实践转向SQL的思考,或者是否有任何魔法来学习基于集的查询语言?

解决方案

如果你是真的, li>

应该使用 CTE 的

来改写一个吞咽飞行的老妇人 > ,我们会在,而不是 2 。




最后,您可以在我的博客中阅读关于我如何担心和学会爱 SQL (我几乎忘了我写了):







另外还有一篇关于主题的文章:






How do I stop thinking every query in terms of cursors, procedures and functions and start using SQL as it should be? Do we make the transition to thinking in SQL just by practise or is there any magic to learning the set based query language? What did you do to make the transition?

解决方案

A few examples of what should come to your mind first if you're real SQL geek:

  • Bible concordance is a FULLTEXT index to the Bible

  • Luca Pacioli's Summa de arithmetica which describes double-entry bookkeeping is in fact a normalized database schema

  • When Xerxes I counted his army by walling an area that 10,000 of his men occupied and then marching the other men through this enclosure, he used HASH AGGREGATE method.

  • The House That Jack Built should be rewritten using a self-join.

  • The Twelve Days of Christmas should be rewritten using a self-join and a ROWNUM

  • There Was An Old Woman Who Swallowed a Fly should be rewritten using CTE's

  • If the European Union were called European Union All, we would see 27 spellings for the word euro on a Euro banknote, instead of 2.

And finally you can read a lame article in my blog on how I stopped worrying and learned to love SQL (I almost forgot I wrote it):

And one more article just on the subject:

这篇关于如何在SQL中思考?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 14:57