名著(既に帯に書いてある)の予感がして入手、読了。賢い先輩方、知識をありがとうございます!と頭を下げたいケーススタディ群でした。
【書籍情報】「SQLパズル 第2版 プログラミングが変わる書き方/考え方」著者:ジョー・セルコ、翻訳:ミック/発行:翔泳社/発売日:2007/11/2
読了すれど修了できず。なぜか。
解説がテーブルの構築から始まるので、私の目的外でした…。良著なのは間違いない。エンジニアだったらガツガツやりたかった。ただ私は既存データを整えて分析するアナリストを目指しているので、データベース構築では手が動かなかった。
個人的な感覚として、元データに手で挿入削除をすること、未だに違和感があります。NULL処置や存在するものを整えるのは好きなんですけど、素材をいじくるのは苦手です。遺伝子組み換え感というか。自分のバイアスでデータを汚したくない気持ちもある。
そういう意味では前回読んだ集中演習ガチ分析Onlyが合ってました。あのサンプルほど整ってる元データなんてないけれど。
本の特徴
- SQL重鎮が書いている不朽の名著(翻訳ミックさんの書籍で知った)
- 一般人からの解答に改善案と解説(最適化含む)
- 75例の実用的パズル(あるある例がまんま使えそう)
感想
- 発行から時間がたっている。時代を感じる問題も多々。
- テーブル構築からなのでコードも長い。「あとは読者で試してみたまえ」あり
- 業界人の独自解答が面白い。手続き型思考やめようねと教示。
1.古い。不朽の名著、もう仕方ないです。最新第2版が2007年発行なので、ウィンドウ関数はほぼありません。若干出てきても「OLAP関数」と呼ばれていて、使ってもいいけど互換性がね、といったスタンス。今やSQL主役級のウィンドウ関数。逆に言えばウィンドウ関数なかったらこんなに回り道いるのね。という勉強にはなります。
2.テーブル構築から解説されてるのは本当にありがたい。ただ私が使うGoogle BiqQueryでは、データの取り込みが簡単にできるので、読み込まず。型の統一は大事です。
CREATE TABLE,INTEGER,CHAR(),PRIMARY KEY,UNIQUE...うーん、手動で型を指定はしても、コード内に系統立てて書かないから(Google手動入力はできる)、脳のキャパを優先してスルーしました。
3.各問に「〇〇さんから寄せられた意見」として知識人の解答を掲載してあるので、複数の視点からパズルをとらえられて面白い。この本の醍醐味です。解法は一つじゃない、でもこっちのほうが早くない?(ストレージ含め)とか、入れ子減るよね、とか。
PC性能が上がってるからストレージは気にしなくていいかも。企業で莫大レコードやRDBつなげまくるなら、知っておいた方がいいかとは思う。UNION ALLはソート入らないから早いとか。
発行年が古いことがネックでしたが、読んでよかったです。SQLは通常の手続き型言語とは違うんだよ、手続き型な考え方だとコード回りくどいよ。って、数十年前から言われていたのか…。ということは、両方できる人は頭が柔らかくて賢いんだろうなあ。
訳者ミックさんの著書を読んでいて参考文献に頻繁に出てくるので購入しました。こちらも読み終えたのでまた後日。
********
I had a hunch that it was going to be a masterpiece, so I got it and finished read it. Thank you, wise seniors, for your knowledge! It was a great collection of case studies.
[Book information] “SQL Puzzle 2nd Edition: How to write/think about programming changing” Author: Joe Celko, Translator: Mick / Publisher: Shoeisha
I finished reading it but couldn't try it.
The explanation starts with the construction of the table, so it was outside my purpose... There is no doubt that it is a good book. If I were an engineer, I would have loved to try it out. However, since I am aiming to become an analyst who organizes and analyzes existing data, I was unable to get my hands on building a database.
Personally, I feel uncomfortable with modifying the original data. I like NULL processing and adjusting existing things, but I'm not good at changing materials. It feels like genetically modified. I also don't want to taint the data with my own biases.
In that sense, the intensive training I read last time was more appropriate as it specialized in analysis. Although there is no source data as complete as that sample.
Features of the book
- A timeless masterpiece written by an SQL executive (I learned about it from Translator Mick's book)
- Suggestions for improvement and explanation (including optimisation) of responses from ordinary people
- 75 practical puzzles (some examples seem usable)
Thoughts
- It's been a while since it was published. I felt classic.
- The code is long because it starts with table construction.
- The unique responses from people in the industry are interesting.
1. It has a classic feel. A timeless masterpiece. The latest 2nd edition was released in 2007. There are almost no mainstream window functions these days. Originally called "OLAP functions". Conversely, if you don't use a window function, this is the method you would use. This will be a learning experience.
2. I really appreciate the explanation starting with table construction. However, with Google BiqQuery, which I use, it is easy to import data, so I did not load it. The unification of types is important.
CREATE TABLE, INTEGER, CHAR(), PRIMARY KEY, UNIQUE...Hmm, even if I specify the type manually, I don't write it systematically in the code (Google manual input is possible), so I prioritise brain capacity. I passed it on.
3. The general answers to each question are given as ``opinions'', so it's fun to see the puzzle from different perspectives. This is the best part of the book. There is more than one answer. For example, this source code is lighter and there is less nesting, etc.
Nowadays, PC performance has improved, so you may not need to worry about the load. But if you're going to be combining a lot of records and data at work, I think it's good to know. UNION ALL is faster because it doesn't sort.
I was worried about the publish year, but I'm glad I read it. SQL is different from normal procedural languages, and if you think procedurally, your code will be so long.
I bought this book because I was reading translator Mick's books and it came up a lot in the references. I've also finished reading this one, so I'll come back to it later.
0コメント