Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
sql-workshop-for-web-director-1
Search
Yuta Kurotaki
April 01, 2013
Technology
0
150
sql-workshop-for-web-director-1
ディレクタのためのSQL勉強会の時に使用したスライドです。
Yuta Kurotaki
April 01, 2013
Tweet
Share
More Decks by Yuta Kurotaki
See All by Yuta Kurotaki
CTO Night & Day 2024 Product Feedback Lunch
kurotaky
1
84
ゼロからわかるリザバーコンピューティング
kurotaky
1
880
SUZURI DX 2023
kurotaky
0
120
How GitHub Copilot Transforms Development Productivity
kurotaky
16
11k
The story of repairing my junk keyboard with The kinT keyboard controller
kurotaky
0
1.4k
DevRel_Japan CONFERENCE 2023
kurotaky
1
1.6k
ctoa-wakate-01-company-introduction
kurotaky
0
220
Ethereum for Ruby
kurotaky
2
1.7k
NFTコンテンツでオリジナルグッズ作成を支える技術
kurotaky
1
110
Other Decks in Technology
See All in Technology
AGIについてChatGPTに聞いてみた
blueb
0
130
【Pycon mini 東海 2024】Google Colaboratoryで試すVLM
kazuhitotakahashi
2
520
ノーコードデータ分析ツールで体験する時系列データ分析超入門
negi111111
0
410
マルチモーダル / AI Agent / LLMOps 3つの技術トレンドで理解するLLMの今後の展望
hirosatogamo
37
12k
OCI Security サービス 概要
oracle4engineer
PRO
0
6.5k
第1回 国土交通省 データコンペ参加者向け勉強会③- Snowflake x estie編 -
estie
0
130
Platform Engineering for Software Developers and Architects
syntasso
1
520
100 名超が参加した日経グループ横断の競技型 AWS 学習イベント「Nikkei Group AWS GameDay」の紹介/mediajaws202411
nikkei_engineer_recruiting
1
170
Lambdaと地方とコミュニティ
miu_crescent
2
370
10XにおけるData Contractの導入について: Data Contract事例共有会
10xinc
6
650
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
480
Terraform未経験の御様に対してどの ように導⼊を進めていったか
tkikuchi
2
430
Featured
See All Featured
Side Projects
sachag
452
42k
Producing Creativity
orderedlist
PRO
341
39k
What's new in Ruby 2.0
geeforr
343
31k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
The Cult of Friendly URLs
andyhume
78
6k
What's in a price? How to price your products and services
michaelherold
243
12k
Building Your Own Lightsaber
phodgson
103
6.1k
Done Done
chrislema
181
16k
Designing for Performance
lara
604
68k
Speed Design
sergeychernyshev
25
620
Being A Developer After 40
akosma
86
590k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Transcript
8FCσΟϨΫλʔͷͨΊͷ 42-ษڧձ 134݄1݄༵
42- wϦϨʔγϣφϧσʔλϕʔεͷૢ࡞Λ ߦ͏ͨΊͷݴޠ 134݄1݄༵
SELECT CustomerName FROM Customers; 134݄1݄༵
ϦϨʔγϣφϧσʔλϕʔεʁ w3%#3FMBUJPOBM%BUBCBTF w࠷͘ར༻͞Ε͍ͯΔσʔλϕʔε wσʔλΛਓ͕ؒཧղ͍͢͠ೋ࣍ݩද ͷܗࣜͰཧ 134݄1݄༵
ϦϨʔγϣφϧσʔλϕʔε JE ࢯ໊ ෦ॺ ৬छ ϩϦϙ͘Μ MPMJQPQ σβΠφʔ
Χό͘Μ IFUFNM ΤϯδχΞ Ϧε͘Μ TRBMF σβΠφʔ ͘·͘Μ NVVNVV σΟϨΫλʔ JE ࢯ໊ ෦ॺ ৬छ ϩϦϙ͘Μ MPMJQPQ σβΠφʔ Χό͘Μ IFUFNM ΤϯδχΞ Ϧε͘Μ TRBMF σβΠφʔ ͘·͘Μ NVVNVV σΟϨΫλʔ JE ࢯ໊ ෦ॺ ৬छ ϩϦϙ͘Μ MPMJQPQ σβΠφʔ Χό͘Μ IFUFNM ΤϯδχΞ Ϧε͘Μ TRBMF σβΠφʔ ͘·͘Μ NVVNVV σΟϨΫλʔ JE ࢯ໊ ෦ॺ ৬छ ϩϦϙ͘Μ MPMJQPQ σβΠφʔ Χό͘Μ IFUFNM ΤϯδχΞ Ϧε͘Μ TRBMF σβΠφʔ ͘·͘Μ NVVNVV σΟϨΫλʔ ࣾһJE ࢯ໊ ෦ॺ ৬छ ϩϦϙ͘Μ MPMJQPQ σβΠφʔ Χό͘Μ IFUFNM ΤϯδχΞ Ϧε͘Μ TRBMF σβΠφʔ ͘·͘Μ NVVNVV σΟϨΫλʔ 134݄1݄༵
ςʔϒϧʁ w ςʔϒϧͱදݫີʹಉ͡ͷͰͳ͍ 134݄1݄༵
߲ ߲ ߲ ߲ ϩϦϙ͘Μ ͓͡͞Μ ϖύϘ Ԭ Χό͘Μ ಈ
੨ Ϧε͘Μ υϯάϧ ϧϏʔ γφτϥ ͘·͘Μ ࡪ ςʔϒϧͰͳ͍ʂ 134݄1݄༵
ࣾһ ࣾһJE ࢯ໊ ෦ॺ ৬छ ϩϦϙ͘Μ MPMJQPQ σβΠφʔ
Χό͘Μ IFUFNM ΤϯδχΞ Ϧε͘Μ TRBMF σβΠφʔ ͘·͘Μ NVVNVV σΟϨΫλʔ ςʔϒϧʂ 134݄1݄༵
ςʔϒϧ w ܗ͚ͩʮೋ࣍ݩදʯͰ͋Δ͚ͩͰμϝ w ڞ௨Λ࣋ͬͨϨίʔυΛूΊͨͷ w ςʔϒϧ໊ෳܗͰॻ͚Δ 134݄1݄༵
ࣾһ &NQMPZFFT ࣾһJE ࢯ໊ ෦ॺ ৬छ ϩϦϙ͘Μ MPMJQPQ σβΠφʔ
Χό͘Μ IFUFNM ΤϯδχΞ Ϧε͘Μ TRBMF σβΠφʔ ͘·͘Μ NVVNVV σΟϨΫλʔ ߦ ʢϨίʔυʣ ྻɺଐੑ ʢΧϥϜʣ 134݄1݄༵
ࣾһJE ࢯ໊ /BNF ෦ॺ ৬छ ϩϦϙ͘Μ MPMJQPQ σβΠφʔ
Χό͘Μ IFUFNM ΤϯδχΞ Ϧε͘Μ TRBMF σβΠφʔ ͘·͘Μ NVVNVV σΟϨΫλʔ &NQMPZFFTςʔϒϧ SELECT Name FROM Employees; ࢯ໊ /BNF ϩϦϙ͘Μ Χό͘Μ Ϧε͘Μ ͘·͘Μ &NQMPZFFTςʔϒϧ͔Βࢯ໊ҰཡΛग़͢߹ DataBase 134݄1݄༵
QIQ.Z"ENJOΛͬͯσʔλϕʔε Λૢ࡞ͯ͠ΈΑ͏ w.Z42-αʔόʔΛϒϥβ ͔Βૢ࡞Ͱ ͖·͢ wࠓճIFUFNM ϔςϜϧ Λ͍·͢ 134݄1݄༵
IUUQIFUFNMKQ ʮਃ͠ࠐΈʯ͔ΒΞΧϯτΛ࡞ͯ͠Լ͍͞ʂ 134݄1݄༵
ΞΧϯτ࡞ޙίϯτϩʔϧύωϧʹϩάΠϯɺ ʮσʔλϕʔεʯΛબ 134݄1݄༵
ʮσʔλϕʔε࡞ը໘ʯϘλϯΛΫϦοΫ 134݄1݄༵
σʔλϕʔε໊ͱύεϫʔυΛೖྗͯ͠ ʮσʔλϕʔεΛ࡞͢ΔʯΛΫϦοΫ 134݄1݄༵
σʔλϕʔεͷ࡞͕ྃͨ͠ΒʮΔʯΛΫϦοΫ 134݄1݄༵
ʮQIQ.Z"ENJOʯϘλϯΛΫϦοΫ͢Δ 134݄1݄༵
ઃఆͨ͠Ϣʔβ໊ͱύεϫʔυΛೖྗͯ͠ ʮ࣮ߦ͢ΔʯϘλϯΛΫϦοΫ 134݄1݄༵
ςʔϒϧͷ࡞ create table ςʔϒϧ໊ ( ΧϥϜ໊ ܕ, ΧϥϜ໊ ܕ );
֯εϖʔε 134݄1݄༵
σʔλͷܕ wJOU wDIBS WBSDIBSɹจࣈྻ wEBUF 134݄1݄༵
ࣾһςʔϒϧͷ࡞ create table Employees ( EmployeeID int, EmployeeName varchar(24), Email
varchar(256), Height int(255), Weight int(255), Birthday date, BloodType varchar(2) ); ֯εϖʔε ΧϯϚΛΕͣʹ ࠷ޙʹηϛίϩϯ 134݄1݄༵
ςʔϒϧͷ࡞ create table Products ( ProductID int, ProductCode int, ProductName
varchar(50), Price int, CategoryID varchar(100) ); 134݄1݄༵
&NQMPZFF*% &NQMPZFF /BNF &NBJM )FJHIU 8FJHIU #JSUIEBZ #MPPE5ZQF &NQMPZFFT 1SPEVDU*%
1SPEVDU$PEF 1SPEVDU/BNF 1SJDF $BUFHPSZ*% 1SPEVDUT 134݄1݄༵
ςʔϒϧͷ֬ೝ show tables; ςʔϒϧҰཡදࣔ ςʔϒϧͷ֬ೝ desc Employees; ֯εϖʔε 134݄1݄༵
σʔλϕʔεͷૢ࡞ w࡞ $SFBUF wಡΈग़͠ 3FBE wߋ৽ 6QEBUF wআ %FMFUF 134݄1݄༵
ϨίʔυͷՃ insert into ςʔϒϧ໊ ( ΧϥϜ໊, ΧϥϜ໊ ) values (
, ; ֯εϖʔε 134݄1݄༵
&NQMPZFFTςʔϒϧʹϨίʔυΛՃ insert into Employees ( EmployeeID, EmployeeName, Email, Height, Weight,
Birthday, BloodType ) values ( 1,! 'ϩϦϙ͓͡͞Μ', '
[email protected]
', 170, 70, '2002-01-01', 'A' ); ֯εϖʔε ΧϯϚΛΕͣʹ ࠷ޙʹηϛίϩϯ จࣈྻ b γϯάϧΫΥʔτ ͰғΉ 134݄1݄༵
1SPEVDUTςʔϒϧʹϨίʔυΛՃ insert into Products ( ProductID, ProductCode, ProductName, Price, CategoryID
) values ( 1,! 1001, 'lolipop', 105, 1 ); 134݄1݄༵
σʔλͷಡΈग़͠ select ྻ໊, ྻ໊ from ςʔϒϧ໊ ; 134݄1݄༵
σʔλͷಡΈग़͠ select ProductName from Products ; select EmployeeName, Email from
Employees ; 1SPEVDUςʔϒϧ͔Β1SPEVDU/BNFΛಡΈग़͢ &NQMPZFFTςʔϒϧ͔Β&NQMPZFF/BNFͱ&NBJMΛಡΈग़͢ 134݄1݄༵
શΧϥϜಡΈग़͢ select * from Employees ; &NQMPZFFTςʔϒϧ͔ΒશΧϥϜಡΈग़͢ 134݄1݄༵
ԋࢉ ͠ࢉ Ҿ͖ࢉ ֻ͚ࢉ ׂΓࢉ ༨ࢉ 134݄1݄༵
ԋࢉ select 1 + 1; select Price * 1.05 from
Products ; select 2 * 2; ͨ͢ ͔͚Δ 1SPEVDUTςʔϒϧͷ1SJDFͷʹ͔͚Δ 134݄1݄༵
ؔ w $06/5 w "7( w 46. w ."9 w
.*/ 134݄1݄༵
Ձ֨ͷ࠷େɺฏۉΛٻΊΔ select AVG(Price) from Products; select MAX(Price) from Products; 1SPEVDUTςʔϒϧͷ1SJDFͷͷฏۉΛٻΊΔ
1SPEVDUTςʔϒϧͷ1SJDFͷͷ࠷େΛٻΊΔ 134݄1݄༵
݅Λ͚ͭͯಡΈग़͠ select * from Products where ProductID = 2 ;
1SPEVDUTςʔϒϧͷ1SPEVDU*%͕ͷϨίʔυΛಡΈग़͢ 134݄1݄༵
݅Λ͚ͭͯಡΈग़͠ select * from Products where ProductCode >= 1000 and
Price >= 1000 ; 1SPEVDUTςʔϒϧͷ1SPEVDU$PEF͕Ҏ্͔ͭ1SJDF͕Ҏ্ͷϨίʔυΛಡΈग़͢ 134݄1݄༵
ύλʔϯϚονͰݕࡧ ޙํҰக select EmployeeName from Employees where EmployeeName like 'ά%'
; &NQMPZFFTςʔϒϧͷ&NQMPZFF/BNFͷઌ಄จࣈ͕άͷ&NQMPZFF/BNFΛಡΈग़͢ 134݄1݄༵
ύλʔϯϚονͰݕࡧ લํҰக select EmployeeName from Employees where EmployeeName like '%'
; &NQMPZFFTςʔϒϧͷ&NQMPZFF/BNFͷ࠷ޙͷจࣈ͕ͷ&NQMPZFF/BNFΛಡΈग़͢ 134݄1݄༵
߱ॱʹฒͼସ͑ select * from Products where ProductCode >= 800 order
by ProductID desc ; 1SPEVDUTςʔϒϧͷ1SPEVDU$PEF͕Ҏ্ͷϨίʔυΛ1SPEVDU*%Ͱ߱ॱʹฒͼସ͑ 134݄1݄༵
ঢॱʹฒͼସ͑ select * from Products where ProductCode >= 800 order
by ProductID asc ; 1SPEVDUTςʔϒϧͷ1SPEVDU$PEF͕Ҏ্ͷϨίʔυΛ1SPEVDU*%Ͱঢॱʹฒͼସ͑ 134݄1݄༵
ୈೋճΔͷͰΑΖ͓͘͠ئ͍͠·͢ 134݄1݄༵
͓͢͢Ίຊ wվగ৽൛෮ֶशιϑτ͖42-ॻ͖ ํυϦϧ 134݄1݄༵