Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
SQL実践入門night_LT資料_YASU11552288
Search
Anntoque
January 24, 2018
Programming
600
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SQL実践入門night_LT資料_YASU11552288
Anntoque
January 24, 2018
More Decks by Anntoque
See All by Anntoque
【試されDATA SAPPORO #1】データ基盤を「育てる」コミュニケーション
anntoque
0
35
【Sapporo Data Pioneers #1 】データのライフサイクルとSapporo Data Pioneersの思いについて
anntoque
1
740
【istyle Data Talk #01】越境できるデータの組織・人材を目指して/ istyle data talk 01 Data Organization
anntoque
1
1.1k
what Azure Synapse
anntoque
0
3.2k
REDASH JOURNEY
anntoque
0
1.5k
データドリブンを提供するサービス Brand Officialのアーキテクチャ / brand official architecture
anntoque
0
1.7k
理想の自分を忘れないために Slack and LINE bot を作った話 / Make Slack API and LINE bot to not forget ideal myself
anntoque
0
960
redash運用アンチパターン
anntoque
0
3.6k
Other Decks in Programming
See All in Programming
プロジェクトコードをキレイキレイしよう!暗黙的な参照を読み解く静的解析
ostk0069
0
210
LLM 101
dalinaum
0
470
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
3
1.7k
Railsバージョンを4倍にした話
optim
0
950
S3 TablesのIcebergデータに、AIエージェントからアクセスしてみた / 20261016developersio2026joetsu-accessing-iceberg-in-s3tables-via-agent
kasacchiful
PRO
0
280
Snowflake Openflow Connector利用の勘所 / 20261024developersio2026tokyo-snowflake-openflow
kasacchiful
PRO
0
300
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
410
Rails初心者がパスキーを実装してみて大変だったこと
ktombow
0
150
ChromeでローカルLLM
ryu1013
0
200
地方こそサーバーレス — 10年続けた、顔が見えるチームで確かな基盤を / Serverless Matters Most in Regional Areas — 10 Years of Building Reliable Foundations with Close-Knit Teams
seike460
PRO
1
190
Materialが消えた日 〜真っ白なFlutterキャンバスにRenderObjectで絵を描く〜
umigishiaoi
0
150
あなたの await、OS まで届いてる? strace で覗く JavaScript の非同期
hasutosasaki
1
2.2k
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1.1k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
390
The Curious Case for Waylosing
cassininazir
1
610
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
970
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Abbi's Birthday
coloredviolet
4
11k
WCS-LA-2024
lcolladotor
0
980
Fireside Chat
paigeccino
43
4.1k
Automating Front-end Workflow
addyosmani
1370
210k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
350
Transcript
SELECT * FROM presto_good_point LIMIT 2 @YASU11552288
LT初めてマンです - 山本 泰毅 (Yamamoto Yasutaka) - 株式会社アイスタイル - データエンジニア
* ビッグデータ分析基盤の構築・運用 * クエラー
DBの選択肢がたくさんの時代 弊社に関わるサービスの DB一覧 RDB - Oracle, SQL server, MySQL, MariaDB,
PostgreSQL etc. NoSQL - Hadoop, BigQuery etc.
異機種のDBをつなげて、SELECTしたいけど… ①DBの機能 - SQL ServerのOpen Query - 1つのSQLの中に複数の記法が混在 - MariaDBのconnect
storage engine - 対応機種が少ない ③VLOOKUP ②クラウドにバッチで全突っ込み - リアルタイム性がない -
Prestoを使うと可読性の高いSQLでつなげれる Prestoとは - 分散型のSQLクエリエンジン (https://prestodb.io/) - インメモリでサクサク - zhicwu/presto -
Docker Hub ※ そのままdocker runして実行すると、 ワーカー名に関するエラーが出るので変更必要 クライアント (BIツール、アナリストなど) SQL etc.
接続するDBの設定をして、SQLを書くまでの流れ STEP 1 カタログに接続情報を書き込む $ cat /export/presto/data/etc/catalog/sample.properties connector.name=sqlserver connection-url=jdbc:sqlserver://hostname;databaseName=sampledb connection-user=xxxx
connection-password=xxxx STEP 2 SQLを実行 SELECT * FROM catalog_name.database_name.table_name mssql JOIN other_catalog_name.database_name.table_name mysql ON msslq.id = mysql.id
本題!map_aggで縦横変換しようとすると… - map_aggとは? - MapReduce向けに実装されている関数 (Hive etc.) - 縦横変換とは -
ピボット - SUM(CASE WHEN hoge = 1 THEN 1 ELSE 0 END) AS hoge1_count SUM(CASE WHEN hoge = 2 THEN 1 ELSE 0 END) AS hoge2_count - データに対しても投げれるのだが … - keyがNULLだとエラー出るので、無難に CASE WHENしとくのが吉でした
アイスタイルはデータエンジニア募集中!