SlideShare ist ein Scribd-Unternehmen logo
1 von 62
Downloaden Sie, um offline zu lesen
bf
            SQL

       bleis-tift


February 26, 2011
id:bleis-tift / @bleis
id:bleis-tift / @bleis
id:bleis-tift / @bleis

SQL                      CTE
id:bleis-tift / @bleis

SQL                      CTE
id:bleis-tift / @bleis

SQL                      CTE
SQL
SQL
SQL   bf
SQL   bf

PL/SQL   T-SQL
SQL   bf

         PL/SQL    T-SQL

SELECT        bf
CTE
CTE
CTE
CTE
CTE



Common Table Expression
CTE



Common Table Expression
SQL99
CTE



Common Table Expression
SQL99
CTE



Common Table Expression
SQL99
CTE



Common Table Expression
SQL99


           SELECT
SELECT *
FROM
  (SELECT 1 AS n UNION ALL
   SELECT 3) T;
SELECT *
FROM
  (SELECT 1 AS n UNION ALL
   SELECT 3) T;


1
3
SELECT *
FROM
  (SELECT 1 AS n UNION ALL
   SELECT 3) T;

CTE
WITH T(n) AS (
  SELECT 1 UNION ALL
  SELECT 3
)
SELECT * FROM T;
CTE
CTE




CTE     CTE
CTE




CTE             CTE
      SQL   SELECT
CTE
WITH Hoge(n) AS (
  SELECT 1 UNION ALL
  SELECT n + 1 FROM Hoge
  WHERE n < 3
)
SELECT * FROM Hoge;
CTE
WITH Hoge(n) AS (
  SELECT 1 UNION ALL
  SELECT n + 1 FROM Hoge
  WHERE n < 3
)
SELECT * FROM Hoge;


1
2
3
bf
bf




Brainfuck
bf




Brainfuck
bf




Brainfuck
bf




Brainfuck
bf   CTE
Ruby
Ruby

       CTE
Ruby

       CTE
       CTE
Ruby

             CTE
             CTE
       CTE
Ruby

             CTE
             CTE
       CTE
Ruby

                  CTE
                  CTE
            CTE

       NE
Ruby

                  CTE
                  CTE
            CTE

       NE
WITH                                                                                 , Eval(id, array, ptr, input_pgm, crnt, stdout, stdin) AS (
  Input(id, bf_program, stdin) AS (                                                      SELECT
     SELECT 0, '                                                                              id
>+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++                 , CAST(REPLICATE(CHAR(0), 5000) AS char(5000))
++>-]<.>+++++++++++[<+++++>-]<.>++++++++[<+++>-]<.+++.------.--------.[-]>                 , 1
++++++++[<++++>-]<+.[-]++++++++++.', ''                                                    , bf_program
  )                                                                                        , 1
, BracketTableSrc(id, open_bracket_pos, close_bracket_pos, stack, src, crnt) AS (          , CAST('' AS nvarchar(max))
     SELECT                                                                                , stdin
          id                                                                             FROM
       , 0                                                                                    Input
       , 0                                                                               UNION ALL
       , CAST('' AS varchar(max))                                                        SELECT
       , bf_program                                                                           id
       , 1                                                                                 , CAST(
     FROM                                                                                        CASE SUBSTRING(input_pgm, crnt, 1)
          Input                                                                                  WHEN '+' THEN STUFF(array, ptr, 1, CHAR(ASCII(SUBSTRING(array, ptr, 1)) + 1))
     UNION ALL                                                                                   WHEN '-' THEN STUFF(array, ptr, 1, CHAR(ASCII(SUBSTRING(array, ptr, 1)) - 1))
     SELECT                                                                                      WHEN ',' THEN STUFF(array, ptr, 1, LEFT(stdin, 1))
          id                                                                                              ELSE array
       , CASE LEFT(src, 1)                                                                       END
          WHEN ']' THEN CAST(LEFT(stack, CHARINDEX(' ', stack, 1)) AS int)                    AS char(5000))
                    ELSE 0                                                                 , CASE SUBSTRING(input_pgm, crnt, 1)
          END                                                                                 WHEN '>' THEN ptr + 1
       , CASE LEFT(src, 1)                                                                    WHEN '<' THEN ptr - 1
          WHEN ']' THEN crnt                                                                            ELSE ptr
                    ELSE 0                                                                    END
          END                                                                              , input_pgm
       , CASE LEFT(src, 1)                                                                 , CASE SUBSTRING(input_pgm, crnt, 1)
          WHEN '[' THEN CAST(crnt AS varchar(4)) + ' ' + stack                                WHEN '[' THEN CASE ASCII(SUBSTRING(array, ptr, 1))
          WHEN ']' THEN SUBSTRING(stack, CHARINDEX(' ', stack, 1) + 1, LEN(stack))                           WHEN 0 THEN (SELECT close_bracket_pos FROM BracketTable
                    ELSE stack                                                                                             WHERE Eval.id = BracketTable.id AND open_bracket_pos = crnt) + 1
          END                                                                                                        ELSE crnt + 1
       , SUBSTRING(src, 2, LEN(src))                                                                         END
       , crnt + 1                                                                             WHEN ']' THEN (SELECT open_bracket_pos FROM BracketTable
     FROM                                                                                                     WHERE Eval.id = BracketTable.id AND close_bracket_pos = crnt)
          BracketTableSrc                                                                               ELSE crnt + 1
     WHERE                                                                                    END
          src <> ''                                                                        , CASE SUBSTRING(input_pgm, crnt, 1)
  )                                                                                           WHEN '.' THEN stdout + SUBSTRING(array, ptr, 1)
, BracketTable(id, open_bracket_pos, close_bracket_pos) AS (                                            ELSE stdout
     SELECT                                                                                   END
          id                                                                               , CASE SUBSTRING(input_pgm, crnt, 1)
       , open_bracket_pos                                                                     WHEN ',' THEN SUBSTRING(stdin, 2, LEN(stdin))
       , close_bracket_pos                                                                              ELSE stdin
     FROM                                                                                     END
          BracketTableSrc                                                                FROM
     WHERE                                                                                    Eval
          open_bracket_pos <> 0                                                          WHERE
             AND close_bracket_pos <> 0                                                       crnt <= LEN(input_pgm)
  )                                                                                    )
                                                                                     , Result(id, stdout) AS (
                                                                                         SELECT
                                                                                              id
                                                                                           , stdout
                                                                                         FROM
                                                                                              Eval P
                                                                                         WHERE
                                                                                              crnt = (SELECT MAX(crnt) FROM Eval C WHERE P.id = C.id)
                                                                                       )
                                                                                     SELECT * FROM Result ORDER BY id
                                                                                     OPTION (MAXRECURSION 0)
Q.
Q.
A.
Q.
A.
Q.
A.
Q.
A.
SQL

Weitere ähnliche Inhalte

Was ist angesagt?

Using QString effectively
Using QString effectivelyUsing QString effectively
Using QString effectivelyRoman Okolovich
 
Code as data as code.
Code as data as code.Code as data as code.
Code as data as code.Mike Fogus
 
Naïveté vs. Experience
Naïveté vs. ExperienceNaïveté vs. Experience
Naïveté vs. ExperienceMike Fogus
 
The Macronomicon
The MacronomiconThe Macronomicon
The MacronomiconMike Fogus
 
Fertile Ground: The Roots of Clojure
Fertile Ground: The Roots of ClojureFertile Ground: The Roots of Clojure
Fertile Ground: The Roots of ClojureMike Fogus
 
Functional programming in C++ LambdaNsk
Functional programming in C++ LambdaNskFunctional programming in C++ LambdaNsk
Functional programming in C++ LambdaNskAlexander Granin
 
Create your own PHP extension, step by step - phpDay 2012 Verona
Create your own PHP extension, step by step - phpDay 2012 VeronaCreate your own PHP extension, step by step - phpDay 2012 Verona
Create your own PHP extension, step by step - phpDay 2012 VeronaPatrick Allaert
 
Computer Vision using Ruby and libJIT - RubyConf 2009
Computer Vision using Ruby and libJIT - RubyConf 2009Computer Vision using Ruby and libJIT - RubyConf 2009
Computer Vision using Ruby and libJIT - RubyConf 2009Jan Wedekind
 
Better Software: introduction to good code
Better Software: introduction to good codeBetter Software: introduction to good code
Better Software: introduction to good codeGiordano Scalzo
 
Beyond javascript using the features of tomorrow
Beyond javascript   using the features of tomorrowBeyond javascript   using the features of tomorrow
Beyond javascript using the features of tomorrowAlexander Varwijk
 
Advanced python
Advanced pythonAdvanced python
Advanced pythonEU Edge
 
Ugly code
Ugly codeUgly code
Ugly codeOdd-e
 
The Ring programming language version 1.9 book - Part 32 of 210
The Ring programming language version 1.9 book - Part 32 of 210The Ring programming language version 1.9 book - Part 32 of 210
The Ring programming language version 1.9 book - Part 32 of 210Mahmoud Samir Fayed
 
Basic C++ 11/14 for Python Programmers
Basic C++ 11/14 for Python ProgrammersBasic C++ 11/14 for Python Programmers
Basic C++ 11/14 for Python ProgrammersAppier
 
Groovy grails types, operators, objects
Groovy grails types, operators, objectsGroovy grails types, operators, objects
Groovy grails types, operators, objectsHusain Dalal
 
Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013aleks-f
 
Advanced Python, Part 2
Advanced Python, Part 2Advanced Python, Part 2
Advanced Python, Part 2Zaar Hai
 
How to Clone Flappy Bird in Swift
How to Clone Flappy Bird in SwiftHow to Clone Flappy Bird in Swift
How to Clone Flappy Bird in SwiftGiordano Scalzo
 

Was ist angesagt? (20)

Using QString effectively
Using QString effectivelyUsing QString effectively
Using QString effectively
 
Introduction to Rust
Introduction to RustIntroduction to Rust
Introduction to Rust
 
Code as data as code.
Code as data as code.Code as data as code.
Code as data as code.
 
Naïveté vs. Experience
Naïveté vs. ExperienceNaïveté vs. Experience
Naïveté vs. Experience
 
The Macronomicon
The MacronomiconThe Macronomicon
The Macronomicon
 
Fertile Ground: The Roots of Clojure
Fertile Ground: The Roots of ClojureFertile Ground: The Roots of Clojure
Fertile Ground: The Roots of Clojure
 
Functional programming in C++ LambdaNsk
Functional programming in C++ LambdaNskFunctional programming in C++ LambdaNsk
Functional programming in C++ LambdaNsk
 
Create your own PHP extension, step by step - phpDay 2012 Verona
Create your own PHP extension, step by step - phpDay 2012 VeronaCreate your own PHP extension, step by step - phpDay 2012 Verona
Create your own PHP extension, step by step - phpDay 2012 Verona
 
Computer Vision using Ruby and libJIT - RubyConf 2009
Computer Vision using Ruby and libJIT - RubyConf 2009Computer Vision using Ruby and libJIT - RubyConf 2009
Computer Vision using Ruby and libJIT - RubyConf 2009
 
Better Software: introduction to good code
Better Software: introduction to good codeBetter Software: introduction to good code
Better Software: introduction to good code
 
Beyond javascript using the features of tomorrow
Beyond javascript   using the features of tomorrowBeyond javascript   using the features of tomorrow
Beyond javascript using the features of tomorrow
 
Advanced python
Advanced pythonAdvanced python
Advanced python
 
Ugly code
Ugly codeUgly code
Ugly code
 
Breaking the wall
Breaking the wallBreaking the wall
Breaking the wall
 
The Ring programming language version 1.9 book - Part 32 of 210
The Ring programming language version 1.9 book - Part 32 of 210The Ring programming language version 1.9 book - Part 32 of 210
The Ring programming language version 1.9 book - Part 32 of 210
 
Basic C++ 11/14 for Python Programmers
Basic C++ 11/14 for Python ProgrammersBasic C++ 11/14 for Python Programmers
Basic C++ 11/14 for Python Programmers
 
Groovy grails types, operators, objects
Groovy grails types, operators, objectsGroovy grails types, operators, objects
Groovy grails types, operators, objects
 
Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013Dynamic C++ ACCU 2013
Dynamic C++ ACCU 2013
 
Advanced Python, Part 2
Advanced Python, Part 2Advanced Python, Part 2
Advanced Python, Part 2
 
How to Clone Flappy Bird in Swift
How to Clone Flappy Bird in SwiftHow to Clone Flappy Bird in Swift
How to Clone Flappy Bird in Swift
 

Ähnlich wie そうだ、bf処理系作ろう!もちろんSQLで!

CL metaprogramming
CL metaprogrammingCL metaprogramming
CL metaprogrammingdudarev
 
Python basic
Python basic Python basic
Python basic sewoo lee
 
LeetCode April Coding Challenge
LeetCode April Coding ChallengeLeetCode April Coding Challenge
LeetCode April Coding ChallengeSunil Yadav
 
An example of R code for Data visualization
An example of R code for Data visualizationAn example of R code for Data visualization
An example of R code for Data visualizationLiang (Leon) Zhou
 
Introduction To Lisp
Introduction To LispIntroduction To Lisp
Introduction To Lispkyleburton
 
Unit3 jwfiles
Unit3 jwfilesUnit3 jwfiles
Unit3 jwfilesmrecedu
 
Data Mining With A Simulated Annealing Based Fuzzy Classification System
Data Mining With A Simulated Annealing Based Fuzzy Classification SystemData Mining With A Simulated Annealing Based Fuzzy Classification System
Data Mining With A Simulated Annealing Based Fuzzy Classification SystemJamie (Taka) Wang
 
1.Buffer Overflows
1.Buffer Overflows1.Buffer Overflows
1.Buffer Overflowsphanleson
 
Structured data type
Structured data typeStructured data type
Structured data typeOmkar Majukar
 
#include stdio.h #include stdlib.h #include unistd.h #in.pdf
#include stdio.h #include stdlib.h #include unistd.h #in.pdf#include stdio.h #include stdlib.h #include unistd.h #in.pdf
#include stdio.h #include stdlib.h #include unistd.h #in.pdfcontact34
 
第一回 冬のスイッチ大勉強会 - XBee編 -
第一回 冬のスイッチ大勉強会 - XBee編 -第一回 冬のスイッチ大勉強会 - XBee編 -
第一回 冬のスイッチ大勉強会 - XBee編 -Wataru Kani
 
014 TUPLES.pdf
014 TUPLES.pdf014 TUPLES.pdf
014 TUPLES.pdfamman23
 
ANSI C REFERENCE CARD
ANSI C REFERENCE CARDANSI C REFERENCE CARD
ANSI C REFERENCE CARDTia Ricci
 

Ähnlich wie そうだ、bf処理系作ろう!もちろんSQLで! (20)

CL metaprogramming
CL metaprogrammingCL metaprogramming
CL metaprogramming
 
Python basic
Python basic Python basic
Python basic
 
LeetCode April Coding Challenge
LeetCode April Coding ChallengeLeetCode April Coding Challenge
LeetCode April Coding Challenge
 
Strings part2
Strings part2Strings part2
Strings part2
 
Procesos
ProcesosProcesos
Procesos
 
An example of R code for Data visualization
An example of R code for Data visualizationAn example of R code for Data visualization
An example of R code for Data visualization
 
lecture5.ppt
lecture5.pptlecture5.ppt
lecture5.ppt
 
Introduction To Lisp
Introduction To LispIntroduction To Lisp
Introduction To Lisp
 
C Language Unit-3
C Language Unit-3C Language Unit-3
C Language Unit-3
 
Unit3 jwfiles
Unit3 jwfilesUnit3 jwfiles
Unit3 jwfiles
 
Data Mining With A Simulated Annealing Based Fuzzy Classification System
Data Mining With A Simulated Annealing Based Fuzzy Classification SystemData Mining With A Simulated Annealing Based Fuzzy Classification System
Data Mining With A Simulated Annealing Based Fuzzy Classification System
 
1.Buffer Overflows
1.Buffer Overflows1.Buffer Overflows
1.Buffer Overflows
 
Structured data type
Structured data typeStructured data type
Structured data type
 
#include stdio.h #include stdlib.h #include unistd.h #in.pdf
#include stdio.h #include stdlib.h #include unistd.h #in.pdf#include stdio.h #include stdlib.h #include unistd.h #in.pdf
#include stdio.h #include stdlib.h #include unistd.h #in.pdf
 
CLUSTERGRAM
CLUSTERGRAMCLUSTERGRAM
CLUSTERGRAM
 
第一回 冬のスイッチ大勉強会 - XBee編 -
第一回 冬のスイッチ大勉強会 - XBee編 -第一回 冬のスイッチ大勉強会 - XBee編 -
第一回 冬のスイッチ大勉強会 - XBee編 -
 
DataTypes.ppt
DataTypes.pptDataTypes.ppt
DataTypes.ppt
 
014 TUPLES.pdf
014 TUPLES.pdf014 TUPLES.pdf
014 TUPLES.pdf
 
ANSI C REFERENCE CARD
ANSI C REFERENCE CARDANSI C REFERENCE CARD
ANSI C REFERENCE CARD
 
Strings
StringsStrings
Strings
 

Mehr von bleis tift

PCさえあればいい。
PCさえあればいい。PCさえあればいい。
PCさえあればいい。bleis tift
 
F#の基礎(?)
F#の基礎(?)F#の基礎(?)
F#の基礎(?)bleis tift
 
No more Legacy documents
No more Legacy documentsNo more Legacy documents
No more Legacy documentsbleis tift
 
解説?FSharp.Quotations.Compiler
解説?FSharp.Quotations.Compiler解説?FSharp.Quotations.Compiler
解説?FSharp.Quotations.Compilerbleis tift
 
効果の低いテストの話
効果の低いテストの話効果の低いテストの話
効果の低いテストの話bleis tift
 
テストの自動化を考える前に
テストの自動化を考える前にテストの自動化を考える前に
テストの自動化を考える前にbleis tift
 
札束でExcelを殴る
札束でExcelを殴る札束でExcelを殴る
札束でExcelを殴るbleis tift
 
.NET系開発者から見たJava
.NET系開発者から見たJava.NET系開発者から見たJava
.NET系開発者から見たJavableis tift
 
SI屋のためのF# ~DSL編~
SI屋のためのF# ~DSL編~SI屋のためのF# ~DSL編~
SI屋のためのF# ~DSL編~bleis tift
 
F#事例発表
F#事例発表F#事例発表
F#事例発表bleis tift
 
yield and return (poor English ver)
yield and return (poor English ver)yield and return (poor English ver)
yield and return (poor English ver)bleis tift
 
yieldとreturnの話
yieldとreturnの話yieldとreturnの話
yieldとreturnの話bleis tift
 
F#の基礎(嘘)
F#の基礎(嘘)F#の基礎(嘘)
F#の基礎(嘘)bleis tift
 
現実(えくせる)と戦う話
現実(えくせる)と戦う話現実(えくせる)と戦う話
現実(えくせる)と戦う話bleis tift
 
ラムダでウィザード 滅せよ手続き、とチャーチは言った (※言ってません)
ラムダでウィザード 滅せよ手続き、とチャーチは言った (※言ってません)ラムダでウィザード 滅せよ手続き、とチャーチは言った (※言ってません)
ラムダでウィザード 滅せよ手続き、とチャーチは言った (※言ってません)bleis tift
 
async/await不要論
async/await不要論async/await不要論
async/await不要論bleis tift
 
F#によるFunctional Programming入門
F#によるFunctional Programming入門F#によるFunctional Programming入門
F#によるFunctional Programming入門bleis tift
 
VBAを書きたくない話(Excel-DNAの紹介)
VBAを書きたくない話(Excel-DNAの紹介)VBAを書きたくない話(Excel-DNAの紹介)
VBAを書きたくない話(Excel-DNAの紹介)bleis tift
 
Better C#の脱却を目指して
Better C#の脱却を目指してBetter C#の脱却を目指して
Better C#の脱却を目指してbleis tift
 
モナドハンズオン前座
モナドハンズオン前座モナドハンズオン前座
モナドハンズオン前座bleis tift
 

Mehr von bleis tift (20)

PCさえあればいい。
PCさえあればいい。PCさえあればいい。
PCさえあればいい。
 
F#の基礎(?)
F#の基礎(?)F#の基礎(?)
F#の基礎(?)
 
No more Legacy documents
No more Legacy documentsNo more Legacy documents
No more Legacy documents
 
解説?FSharp.Quotations.Compiler
解説?FSharp.Quotations.Compiler解説?FSharp.Quotations.Compiler
解説?FSharp.Quotations.Compiler
 
効果の低いテストの話
効果の低いテストの話効果の低いテストの話
効果の低いテストの話
 
テストの自動化を考える前に
テストの自動化を考える前にテストの自動化を考える前に
テストの自動化を考える前に
 
札束でExcelを殴る
札束でExcelを殴る札束でExcelを殴る
札束でExcelを殴る
 
.NET系開発者から見たJava
.NET系開発者から見たJava.NET系開発者から見たJava
.NET系開発者から見たJava
 
SI屋のためのF# ~DSL編~
SI屋のためのF# ~DSL編~SI屋のためのF# ~DSL編~
SI屋のためのF# ~DSL編~
 
F#事例発表
F#事例発表F#事例発表
F#事例発表
 
yield and return (poor English ver)
yield and return (poor English ver)yield and return (poor English ver)
yield and return (poor English ver)
 
yieldとreturnの話
yieldとreturnの話yieldとreturnの話
yieldとreturnの話
 
F#の基礎(嘘)
F#の基礎(嘘)F#の基礎(嘘)
F#の基礎(嘘)
 
現実(えくせる)と戦う話
現実(えくせる)と戦う話現実(えくせる)と戦う話
現実(えくせる)と戦う話
 
ラムダでウィザード 滅せよ手続き、とチャーチは言った (※言ってません)
ラムダでウィザード 滅せよ手続き、とチャーチは言った (※言ってません)ラムダでウィザード 滅せよ手続き、とチャーチは言った (※言ってません)
ラムダでウィザード 滅せよ手続き、とチャーチは言った (※言ってません)
 
async/await不要論
async/await不要論async/await不要論
async/await不要論
 
F#によるFunctional Programming入門
F#によるFunctional Programming入門F#によるFunctional Programming入門
F#によるFunctional Programming入門
 
VBAを書きたくない話(Excel-DNAの紹介)
VBAを書きたくない話(Excel-DNAの紹介)VBAを書きたくない話(Excel-DNAの紹介)
VBAを書きたくない話(Excel-DNAの紹介)
 
Better C#の脱却を目指して
Better C#の脱却を目指してBetter C#の脱却を目指して
Better C#の脱却を目指して
 
モナドハンズオン前座
モナドハンズオン前座モナドハンズオン前座
モナドハンズオン前座
 

Kürzlich hochgeladen

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 

Kürzlich hochgeladen (20)

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 

そうだ、bf処理系作ろう!もちろんSQLで!

  • 1. bf SQL bleis-tift February 26, 2011
  • 7.
  • 8. SQL
  • 9. SQL
  • 10.
  • 11. SQL bf
  • 12. SQL bf PL/SQL T-SQL
  • 13. SQL bf PL/SQL T-SQL SELECT bf
  • 14.
  • 15.
  • 16. CTE
  • 17.
  • 18. CTE
  • 19. CTE
  • 20. CTE
  • 26. SELECT * FROM (SELECT 1 AS n UNION ALL SELECT 3) T;
  • 27. SELECT * FROM (SELECT 1 AS n UNION ALL SELECT 3) T; 1 3
  • 28. SELECT * FROM (SELECT 1 AS n UNION ALL SELECT 3) T; CTE WITH T(n) AS ( SELECT 1 UNION ALL SELECT 3 ) SELECT * FROM T;
  • 29. CTE
  • 30. CTE CTE CTE
  • 31. CTE CTE CTE SQL SELECT
  • 32. CTE WITH Hoge(n) AS ( SELECT 1 UNION ALL SELECT n + 1 FROM Hoge WHERE n < 3 ) SELECT * FROM Hoge;
  • 33. CTE WITH Hoge(n) AS ( SELECT 1 UNION ALL SELECT n + 1 FROM Hoge WHERE n < 3 ) SELECT * FROM Hoge; 1 2 3
  • 34. bf
  • 39.
  • 40.
  • 41.
  • 42.
  • 43. bf CTE
  • 44.
  • 45. Ruby
  • 46. Ruby CTE
  • 47. Ruby CTE CTE
  • 48. Ruby CTE CTE CTE
  • 49. Ruby CTE CTE CTE
  • 50. Ruby CTE CTE CTE NE
  • 51. Ruby CTE CTE CTE NE
  • 52.
  • 53.
  • 54.
  • 55. WITH , Eval(id, array, ptr, input_pgm, crnt, stdout, stdin) AS ( Input(id, bf_program, stdin) AS ( SELECT SELECT 0, ' id >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++ , CAST(REPLICATE(CHAR(0), 5000) AS char(5000)) ++>-]<.>+++++++++++[<+++++>-]<.>++++++++[<+++>-]<.+++.------.--------.[-]> , 1 ++++++++[<++++>-]<+.[-]++++++++++.', '' , bf_program ) , 1 , BracketTableSrc(id, open_bracket_pos, close_bracket_pos, stack, src, crnt) AS ( , CAST('' AS nvarchar(max)) SELECT , stdin id FROM , 0 Input , 0 UNION ALL , CAST('' AS varchar(max)) SELECT , bf_program id , 1 , CAST( FROM CASE SUBSTRING(input_pgm, crnt, 1) Input WHEN '+' THEN STUFF(array, ptr, 1, CHAR(ASCII(SUBSTRING(array, ptr, 1)) + 1)) UNION ALL WHEN '-' THEN STUFF(array, ptr, 1, CHAR(ASCII(SUBSTRING(array, ptr, 1)) - 1)) SELECT WHEN ',' THEN STUFF(array, ptr, 1, LEFT(stdin, 1)) id ELSE array , CASE LEFT(src, 1) END WHEN ']' THEN CAST(LEFT(stack, CHARINDEX(' ', stack, 1)) AS int) AS char(5000)) ELSE 0 , CASE SUBSTRING(input_pgm, crnt, 1) END WHEN '>' THEN ptr + 1 , CASE LEFT(src, 1) WHEN '<' THEN ptr - 1 WHEN ']' THEN crnt ELSE ptr ELSE 0 END END , input_pgm , CASE LEFT(src, 1) , CASE SUBSTRING(input_pgm, crnt, 1) WHEN '[' THEN CAST(crnt AS varchar(4)) + ' ' + stack WHEN '[' THEN CASE ASCII(SUBSTRING(array, ptr, 1)) WHEN ']' THEN SUBSTRING(stack, CHARINDEX(' ', stack, 1) + 1, LEN(stack)) WHEN 0 THEN (SELECT close_bracket_pos FROM BracketTable ELSE stack WHERE Eval.id = BracketTable.id AND open_bracket_pos = crnt) + 1 END ELSE crnt + 1 , SUBSTRING(src, 2, LEN(src)) END , crnt + 1 WHEN ']' THEN (SELECT open_bracket_pos FROM BracketTable FROM WHERE Eval.id = BracketTable.id AND close_bracket_pos = crnt) BracketTableSrc ELSE crnt + 1 WHERE END src <> '' , CASE SUBSTRING(input_pgm, crnt, 1) ) WHEN '.' THEN stdout + SUBSTRING(array, ptr, 1) , BracketTable(id, open_bracket_pos, close_bracket_pos) AS ( ELSE stdout SELECT END id , CASE SUBSTRING(input_pgm, crnt, 1) , open_bracket_pos WHEN ',' THEN SUBSTRING(stdin, 2, LEN(stdin)) , close_bracket_pos ELSE stdin FROM END BracketTableSrc FROM WHERE Eval open_bracket_pos <> 0 WHERE AND close_bracket_pos <> 0 crnt <= LEN(input_pgm) ) ) , Result(id, stdout) AS ( SELECT id , stdout FROM Eval P WHERE crnt = (SELECT MAX(crnt) FROM Eval C WHERE P.id = C.id) ) SELECT * FROM Result ORDER BY id OPTION (MAXRECURSION 0)
  • 56.
  • 57. Q.
  • 58. Q. A.
  • 59. Q. A.
  • 60. Q. A.
  • 61. Q. A.
  • 62. SQL