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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Anntoque
January 24, 2018
Programming
590
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
30
【Sapporo Data Pioneers #1 】データのライフサイクルとSapporo Data Pioneersの思いについて
anntoque
1
720
【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
950
redash運用アンチパターン
anntoque
0
3.6k
Other Decks in Programming
See All in Programming
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
20
21k
プロダクトコードからライブラリの境界を見つける
elmetal
PRO
0
110
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
540
GitHubハンズオン講座 — 実務レベルのチーム開発のフローを身につけよう
junhat6
0
120
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
7
1.9k
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.5k
MVNOの申込からeSIM開通までをiOSアプリでつなぐ- 本人確認・MNP・通信事業者基盤をまたぐ実装
satotakeshi
0
540
R8 の設定見直しでアプリサイズ削減
andpad
0
180
カツオ、ご期待ください
suneo3476
0
150
CodeRabbitの効果検証と過ごしてみた3ヶ月
armondando
0
150
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
そのリトライ、死んだコネクションを使い回していませんか ── GoのHTTPクライアントとHTTP/2を実プロダクト障害から学び直す
myus4a
0
390
Featured
See All Featured
HDC tutorial
michielstock
2
940
Bash Introduction
62gerente
615
220k
Paper Plane
katiecoart
PRO
4
54k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Visualization
eitanlees
153
17k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
420
The Cult of Friendly URLs
andyhume
79
7k
The World Runs on Bad Software
bkeepers
PRO
72
12k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
930
The agentic SEO stack - context over prompts
schlessera
0
970
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.2k
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しとくのが吉でした
アイスタイルはデータエンジニア募集中!