oracle 学习编写复杂报告查询的最佳在线 SQL 教程是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/939693/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 18:19:27  来源:igfitidea点击:

What is the best online SQL tutorial for learning to write complex reporting queries?

sqloraclereporting

提问by Jeroen Dirks

My SQL skills are rather limited and since I find myself working with a DB (Oracle) a lot lately I would like to get beyond the basic select statements.

我的 SQL 技能相当有限,因为我发现自己最近经常使用 DB (Oracle),所以我想超越基本的 select 语句。

I want to write queries that do things like get data from multiple tables, sum quantities, compare dates, group, filter etc.

我想编写查询来执行诸如从多个表中获取数据、求和数量、比较日期、分组、过滤器等操作。

What sites can you recommend for getting SQL reporting skills to a more advanced level?

您可以推荐哪些站点以将 SQL 报告技能提升到更高级的水平?

回答by Neil Kodner

Pick up Joe Celcko's SQL For Smarties. That's one of the definitive take-your-sql-to-the-next-level books. Otherwise, just keep writing queries.

拿起 Joe Celcko 的SQL For Smarties。这是一本权威的将您的 sql 带到下一级别的书籍。否则,只需继续编写查询。

Make sure you understand joins. Since the beginning of time, my SQL methodology has always been row-count driven - In other words, as I write a complicated query, I'm always #1 making sure it returns the correct number of rows. If your rowcount is correct, then your sums/groups/aggregates will all be correct. And they are VERY easy to mess up.

确保您了解联接。从一开始,我的 SQL 方法就一直是行数驱动的——换句话说,当我编写一个复杂的查询时,我总是 #1 确保它返回正确的行数。如果您的行数正确,那么您的总和/组/聚合都将正确。他们很容易搞砸。

Make sure you understand the data. Make sure you understand keys and uniqueness so that you can enforce your joins.

确保您了解数据。确保您了解键和唯一性,以便您可以强制执行您的连接。

You can also read asktom.oracle.comfor a lot of really cool SQL trickery. Laurent Schneideris also very cutting-edge sql-wise. I wouldn't be half the DBA/Developer I am today had I not set asktom as my home page for the last 5-6 years.

您还可以阅读asktom.oracle.com以了解许多非常酷的 SQL技巧Laurent Schneider在 sql 方面也非常前沿。如果在过去的 5-6 年里我没有将 asktom 设置为我的主页,我就不会成为今天的 DBA/开发人员的一半。

Finally, make sure you understand set based operations. Think of the result set as a whole, not just a collection of rows. It'll click as you do it. This relates back to the row-count-driven methodology.

最后,请确保您了解基于集合的操作。将结果集视为一个整体,而不仅仅是行的集合。它会在你做的时候点击。这与行计数驱动的方法有关。

回答by J. Polfer

I know this isn't online, but it fits your bill to a T:

我知道这不是在线的,但它符合您对 T 的要求:

I would recommend picking up a copy of Anthony Mollinaro's SQL Cookbook. It describes how to do lots of complicated things that go beyond the basic SELECT FROM WHERE . In a prev. life, when doing lots of queries for a prev. job, that book was my life saver and people borrowed that book a lot. It has lots of very clear examples, and they range from the simple (How to retrieve a subset of rows on a table) to the complex (using window functions to generate histograms).

我建议您拿起一份 Anthony Mollinaro 的SQL Cookbook。它描述了如何做许多超出基本 SELECT FROM WHERE 的复杂事情。在上一篇 生活,当对上一个进行大量查询时。工作,那本书是我的救命稻草,人们经常借这本书。它有很多非常清晰的例子,它们的范围从简单的(如何检索表上的行的子集)到复杂的(使用窗口函数生成直方图)。

It's not free, but the book will pay for itself rather quickly, and I imagine would answer most of the questions you would have. NOTE: I have no connection with O'Reilly or Mr. Mollinaro, I simply think this book is awesome and ridiculously helpful.

它不是免费的,但是这本书很快就会收回成本,而且我想它会回答您的大部分问题。注意:我与 O'Reilly 或 Mollinaro 先生没有任何关系,我只是认为这本书很棒而且非常有用。

回答by tuinstoel

Read chapter 20, 21 and 22 of the Oracle data ware house guide: http://download.oracle.com/docs/cd/B28359_01/server.111/b28313/toc.htm. It's about grouping, analytics and the model clause.

阅读 Oracle 数据仓库指南的第 20、21 和 22 章:http: //download.oracle.com/docs/cd/B28359_01/server.111/b28313/toc.htm。这是关于分组、分析和模型条款。

回答by scottm

W3 Schools SQL Tutorialis a good place to start. It gives some examples of the different types of joins and details a lot of the functions (i.e. sum, count, avg). I really had to build a foundation in SQL before understanding complex queries.

W3 Schools SQL 教程是一个很好的起点。它给出了一些不同类型连接的示例,并详细介绍了许多函数(即 sum、count、avg)。在理解复杂查询之前,我真的必须在 SQL 中打下基础。

回答by eric.christensen

I just found a site called SQL Tutorialthat I think is pretty good and wanted to share with the community. It is at http://www.sql-tutorial.com/

我刚刚找到了一个名为SQL 教程的网站,我认为它非常好,想与社区分享。它位于http://www.sql-tutorial.com/