SlideShare a Scribd company logo
SQLの話
闇鍋プログラミング勉強会
@choplin
    Web/DBエンジニア




   現実
SQLはDBのデータを操作する為のDSL
     と思っていませんか?
オールドタイプ
SQLは
チューリング完全
大事なことなので後二回言います
SQL
輝かしい歴史
Year      Name          Alias                                         Comments

1986      SQL-86     SQL-87             First formalized by ANSI.

1989      SQL-89     FIPS 127-1         Minor revision, adopted as FIPS 127-1.

1992      SQL-92     SQL2, FIPS 127-2   Major revision (ISO 9075), Entry Level SQL-92 adopted as FIPS 127-2.
1999      SQL:1999   SQL3               Added regular expression matching, recursive queries, triggers, support for
                                        procedural and control-of-flow statements, non-scalar types, and some object-
                                        oriented features.
2003      SQL:2003   SQL 2003           Introduced XML-related features, window functions, standardized sequences,
                                        and columns with auto-generated values (including identity-columns).

2006      SQL:2006   SQL 2006           ISO/IEC 9075-14:2006 defines ways in which SQL can be used in conjunction
                                        with XML. It defines ways of importing and storing XML data in an SQL
                                        database, manipulating it within the database and publishing both XML and
                                        conventional SQL-data in XML form. In addition, it enables applications to
                                        integrate into their SQL code the use of XQuery, the XML Query Language
                                        published by the World Wide Web Consortium (W3C), to concurrently access
                                        ordinary SQL-data and XML documents.[29]

2008      SQL:2008   SQL 2008           Legalizes ORDER BY outside cursor definitions. Adds INSTEAD OF triggers.
                                        Adds the TRUNCATE statement.[30]
2011      SQL:2011



                         http://en.wikipedia.org/wiki/SQL より
Year      Name          Alias                                         Comments

1986      SQL-86     SQL-87             First formalized by ANSI.

1989      SQL-89     FIPS 127-1         Minor revision, adopted as FIPS 127-1.

1992
1999
          SQL-92
          SQL:1999   SQL3
                              CASE Expressionrecursive queries, triggers, support for
                     SQL2, FIPS 127-2
                                 Major revision (ISO 9075), Entry Level SQL-92 adopted as FIPS 127-2.
                                 Added regular expression matching,
                                        procedural and control-of-flow statements, non-scalar types, and some object-
                                        oriented features.
2003      SQL:2003   SQL 2003           Introduced XML-related features, window functions, standardized sequences,
                                        and columns with auto-generated values (including identity-columns).

2006      SQL:2006   SQL 2006           ISO/IEC 9075-14:2006 defines ways in which SQL can be used in conjunction
                                        with XML. It defines ways of importing and storing XML data in an SQL
                                        database, manipulating it within the database and publishing both XML and
                                        conventional SQL-data in XML form. In addition, it enables applications to
                                        integrate into their SQL code the use of XQuery, the XML Query Language
                                        published by the World Wide Web Consortium (W3C), to concurrently access
                                        ordinary SQL-data and XML documents.[29]

2008      SQL:2008   SQL 2008           Legalizes ORDER BY outside cursor definitions. Adds INSTEAD OF triggers.
                                        Adds the TRUNCATE statement.[30]
2011      SQL:2011



                         http://en.wikipedia.org/wiki/SQL より
Year      Name          Alias                                        Comments

1986      SQL-86     SQL-87             First formalized by ANSI.

1989      SQL-89     FIPS 127-1         Minor revision, adopted as FIPS 127-1.

1992
1999
          SQL-92
          SQL:1999   SQL3
                              CASE Expressionrecursive queries, triggers, support for
                     SQL2, FIPS 127-2
                                  Major revision (ISO 9075), Entry Level SQL-92 adopted as FIPS 127-2.
                                  Added regular expression matching,

                               Recursive Query
                                  procedural and control-of-flow statements, non-scalar types, and some object-
                                  oriented features.
2003      SQL:2003   SQL 2003           Introduced XML-related features, window functions, standardized sequences,
                                        and columns with auto-generated values (including identity-columns).

2006      SQL:2006   SQL 2006           ISO/IEC 9075-14:2006 defines ways in which SQL can be used in conjunction
                                        with XML. It defines ways of importing and storing XML data in an SQL
                                        database, manipulating it within the database and publishing both XML and
                                        conventional SQL-data in XML form. In addition, it enables applications to
                                        integrate into their SQL code the use of XQuery, the XML Query Language
                                        published by the World Wide Web Consortium (W3C), to concurrently access
                                        ordinary SQL-data and XML documents.[29]

2008      SQL:2008   SQL 2008           Legalizes ORDER BY outside cursor definitions. Adds INSTEAD OF triggers.
                                        Adds the TRUNCATE statement.[30]
2011      SQL:2011



                         http://en.wikipedia.org/wiki/SQL より
Year      Name          Alias                                        Comments

1986      SQL-86     SQL-87             First formalized by ANSI.

1989      SQL-89     FIPS 127-1         Minor revision, adopted as FIPS 127-1.

1992
1999
          SQL-92
          SQL:1999   SQL3
                            CASE Expressionrecursive queries, triggers, support for
                     SQL2, FIPS 127-2
                                 Major revision (ISO 9075), Entry Level SQL-92 adopted as FIPS 127-2.
                                 Added regular expression matching,

                              Recursive Query non-scalar
                                 procedural and control-of-flow statements, non-scalar types, and some object-
                                 oriented features.
2003      SQL:2003   SQL 2003
                                                                                     types
                                 Introduced XML-related features, window functions, standardized sequences,
                                 and columns with auto-generated values (including identity-columns).

2006      SQL:2006   SQL 2006           ISO/IEC 9075-14:2006 defines ways in which SQL can be used in conjunction
                                        with XML. It defines ways of importing and storing XML data in an SQL
                                        database, manipulating it within the database and publishing both XML and
                                        conventional SQL-data in XML form. In addition, it enables applications to
                                        integrate into their SQL code the use of XQuery, the XML Query Language
                                        published by the World Wide Web Consortium (W3C), to concurrently access
                                        ordinary SQL-data and XML documents.[29]

2008      SQL:2008   SQL 2008           Legalizes ORDER BY outside cursor definitions. Adds INSTEAD OF triggers.
                                        Adds the TRUNCATE statement.[30]
2011      SQL:2011



                         http://en.wikipedia.org/wiki/SQL より
構造化定理

• 逐次
• 分岐
• 繰り返し
構造化定理

         =>   サブクエリ
• 逐次
              WITH句
• 分岐
• 繰り返し
構造化定理

         => サブクエリ
• 逐次
            WITH句
• 分岐     => CASE式

• 繰り返し
構造化定理

         => サブクエリ
• 逐次
            WITH句
• 分岐     => CASE式

• 繰り返し   =>   再帰クエリ
SQLは
チューリング完全
PostgreSQL
実例一
素因数分解
Demo
実例二
Grass
Grassとは?

λ計算ベースの関数型言語
http://www.blue.sky.or.jp/grass/
Demo

http://choplin.github.com/blog/2012/03/07/grass-on-sql/
ついでに
ほむほむ
http://d.hatena.ne.jp/yuroyoro/20110601/1306908421
Demo
結論
SQLは
チューリング完全
ありがとうございました

More Related Content

PDF
Database concurrency and transactions - Tal Olier
PPT
Vnsispl dbms concepts_ch3
PDF
BI for the DBA
PPTX
Sqlpass The Magic Of Replication
PPTX
Database Systems - SQL - DCL Statements (Chapter 3/4)
PPT
Advanced sql injection
PPTX
MS SQL - Database Programming Concepts by RSolutions
PPTX
ConFoo MySQL Replication Evolution : From Simple to Group Replication
Database concurrency and transactions - Tal Olier
Vnsispl dbms concepts_ch3
BI for the DBA
Sqlpass The Magic Of Replication
Database Systems - SQL - DCL Statements (Chapter 3/4)
Advanced sql injection
MS SQL - Database Programming Concepts by RSolutions
ConFoo MySQL Replication Evolution : From Simple to Group Replication

What's hot (16)

PDF
spring-tutorial
PPT
Mysql Ppt
PDF
Introducing ms sql_server
PDF
MFC Whitepaper
PPT
Bab 6 pendukung
PPTX
Intro to T-SQL - 1st session
PDF
Axis2 architecture and implementation
PDF
Sql server difference faqs- 5
PPTX
Jdbc
DOC
Sql server
PDF
Concepts of NonStop SQL/MX: Part 3 - Introduction to Metadata
PDF
Sql12
PDF
Arrays and lists in sql server 2008
PDF
Oracle sql & plsql
PDF
PDF
Mssm及assm下索引叶块分裂的测试
spring-tutorial
Mysql Ppt
Introducing ms sql_server
MFC Whitepaper
Bab 6 pendukung
Intro to T-SQL - 1st session
Axis2 architecture and implementation
Sql server difference faqs- 5
Jdbc
Sql server
Concepts of NonStop SQL/MX: Part 3 - Introduction to Metadata
Sql12
Arrays and lists in sql server 2008
Oracle sql & plsql
Mssm及assm下索引叶块分裂的测试
Ad

Viewers also liked (8)

PDF
groonga with PostgreSQL
PDF
2010/7/31 LTの虎@LL Tiger
PDF
Write parser with fun!
KEY
Start Vim script @Ujihisa.vim 2011/11/19
PDF
第一回Mongo dbソースコードリーディング 20110628
KEY
Mongo db勉強会20110730
KEY
カジュアルにソースコードリーディング
PDF
qpstudy 2013.07 NoSQL
groonga with PostgreSQL
2010/7/31 LTの虎@LL Tiger
Write parser with fun!
Start Vim script @Ujihisa.vim 2011/11/19
第一回Mongo dbソースコードリーディング 20110628
Mongo db勉強会20110730
カジュアルにソースコードリーディング
qpstudy 2013.07 NoSQL
Ad

Similar to SQLの話 (20)

PDF
SQL Commands
PPT
Structured query language
PPT
Structured query language
PDF
History of SQL, Evolution of SQLHistory of SQL, Evolution of SQL
PDF
SQL Overview
PDF
9767410 - Index
PPT
PO WER - Piotr Mariat - Sql
PPTX
SQL ppt.pptx
PPTX
PDF
SQL Tutorial
PDF
PDF
Sql server difference faqs- 6
PPTX
Cursors, triggers, procedures
PPTX
Sql basics
PDF
Sql overview-1232931296681161-1
DOC
Module 3
PPTX
SQL things ace series of the thing useful
PPTX
BITM3730Week14.pptx
PPTX
Structured query language presentation.pptx
SQL Commands
Structured query language
Structured query language
History of SQL, Evolution of SQLHistory of SQL, Evolution of SQL
SQL Overview
9767410 - Index
PO WER - Piotr Mariat - Sql
SQL ppt.pptx
SQL Tutorial
Sql server difference faqs- 6
Cursors, triggers, procedures
Sql basics
Sql overview-1232931296681161-1
Module 3
SQL things ace series of the thing useful
BITM3730Week14.pptx
Structured query language presentation.pptx

Recently uploaded (20)

PPTX
45-Days-of-Engineering-Excellence-132-kV-Grid-Substation-Training.pptx
PDF
Transmission John Deere 370E 410E 460E Technical Manual.pdf
PDF
Compact Excavator Volvo EC55 Service Repair Manual.pdf
PPTX
Money and credit.pptx from economice class IX
PDF
Fuel injection pump Volvo EC55 Repair Manual.pdf
PPTX
Moral Theology (PREhhhhhhhhhhhhhhhhhhhhhLIMS) (1).pptx
PDF
6. Chapter Twenty_Managing Mass Communications Advertising Sales Promotions E...
PDF
Dongguan Sunnew ESS Profile for the year of 2023
PPTX
Business Economics uni 1.pptxRTRETRETRTRETRETRETRETERT
PPTX
Applications of SAP S4HANA in Mechanical by Sidhant Vohra (SET23A24040166).pptx
PDF
GMPL auto injector molding toollllllllllllllll
PDF
Lubrication system for Automotive technologies
PPTX
Quarter-1-Lesson-5-sdf wgwefwgwefgwgwgwewgwewgwewwedgfwrwtudents-copy.pptx
PDF
eti_09_TestPrecedurebdciwbwib wdjkcwnowe wdnwdw
PPTX
Constitutional Design PPT.pptxl from social science class IX
PPTX
description of motor equipments and its process.pptx
PDF
Cylinder head Volvo EC55 Service Repair Manual.pdf
PPTX
Independence_Day_Patriotic theme (1).pptx
DOC
EAU-960 COMBINED INJECTION AND IGNITION SYSTEM WITH ELECTRONIC REGULATION.doc
PPTX
368455847-Relibility RJS-Relibility-PPT-1.pptx
45-Days-of-Engineering-Excellence-132-kV-Grid-Substation-Training.pptx
Transmission John Deere 370E 410E 460E Technical Manual.pdf
Compact Excavator Volvo EC55 Service Repair Manual.pdf
Money and credit.pptx from economice class IX
Fuel injection pump Volvo EC55 Repair Manual.pdf
Moral Theology (PREhhhhhhhhhhhhhhhhhhhhhLIMS) (1).pptx
6. Chapter Twenty_Managing Mass Communications Advertising Sales Promotions E...
Dongguan Sunnew ESS Profile for the year of 2023
Business Economics uni 1.pptxRTRETRETRTRETRETRETRETERT
Applications of SAP S4HANA in Mechanical by Sidhant Vohra (SET23A24040166).pptx
GMPL auto injector molding toollllllllllllllll
Lubrication system for Automotive technologies
Quarter-1-Lesson-5-sdf wgwefwgwefgwgwgwewgwewgwewwedgfwrwtudents-copy.pptx
eti_09_TestPrecedurebdciwbwib wdjkcwnowe wdnwdw
Constitutional Design PPT.pptxl from social science class IX
description of motor equipments and its process.pptx
Cylinder head Volvo EC55 Service Repair Manual.pdf
Independence_Day_Patriotic theme (1).pptx
EAU-960 COMBINED INJECTION AND IGNITION SYSTEM WITH ELECTRONIC REGULATION.doc
368455847-Relibility RJS-Relibility-PPT-1.pptx

SQLの話

  • 2. @choplin Web/DBエンジニア 現実
  • 3. SQLはDBのデータを操作する為のDSL と思っていませんか?
  • 8. Year Name Alias Comments 1986 SQL-86 SQL-87 First formalized by ANSI. 1989 SQL-89 FIPS 127-1 Minor revision, adopted as FIPS 127-1. 1992 SQL-92 SQL2, FIPS 127-2 Major revision (ISO 9075), Entry Level SQL-92 adopted as FIPS 127-2. 1999 SQL:1999 SQL3 Added regular expression matching, recursive queries, triggers, support for procedural and control-of-flow statements, non-scalar types, and some object- oriented features. 2003 SQL:2003 SQL 2003 Introduced XML-related features, window functions, standardized sequences, and columns with auto-generated values (including identity-columns). 2006 SQL:2006 SQL 2006 ISO/IEC 9075-14:2006 defines ways in which SQL can be used in conjunction with XML. It defines ways of importing and storing XML data in an SQL database, manipulating it within the database and publishing both XML and conventional SQL-data in XML form. In addition, it enables applications to integrate into their SQL code the use of XQuery, the XML Query Language published by the World Wide Web Consortium (W3C), to concurrently access ordinary SQL-data and XML documents.[29] 2008 SQL:2008 SQL 2008 Legalizes ORDER BY outside cursor definitions. Adds INSTEAD OF triggers. Adds the TRUNCATE statement.[30] 2011 SQL:2011 http://en.wikipedia.org/wiki/SQL より
  • 9. Year Name Alias Comments 1986 SQL-86 SQL-87 First formalized by ANSI. 1989 SQL-89 FIPS 127-1 Minor revision, adopted as FIPS 127-1. 1992 1999 SQL-92 SQL:1999 SQL3 CASE Expressionrecursive queries, triggers, support for SQL2, FIPS 127-2 Major revision (ISO 9075), Entry Level SQL-92 adopted as FIPS 127-2. Added regular expression matching, procedural and control-of-flow statements, non-scalar types, and some object- oriented features. 2003 SQL:2003 SQL 2003 Introduced XML-related features, window functions, standardized sequences, and columns with auto-generated values (including identity-columns). 2006 SQL:2006 SQL 2006 ISO/IEC 9075-14:2006 defines ways in which SQL can be used in conjunction with XML. It defines ways of importing and storing XML data in an SQL database, manipulating it within the database and publishing both XML and conventional SQL-data in XML form. In addition, it enables applications to integrate into their SQL code the use of XQuery, the XML Query Language published by the World Wide Web Consortium (W3C), to concurrently access ordinary SQL-data and XML documents.[29] 2008 SQL:2008 SQL 2008 Legalizes ORDER BY outside cursor definitions. Adds INSTEAD OF triggers. Adds the TRUNCATE statement.[30] 2011 SQL:2011 http://en.wikipedia.org/wiki/SQL より
  • 10. Year Name Alias Comments 1986 SQL-86 SQL-87 First formalized by ANSI. 1989 SQL-89 FIPS 127-1 Minor revision, adopted as FIPS 127-1. 1992 1999 SQL-92 SQL:1999 SQL3 CASE Expressionrecursive queries, triggers, support for SQL2, FIPS 127-2 Major revision (ISO 9075), Entry Level SQL-92 adopted as FIPS 127-2. Added regular expression matching, Recursive Query procedural and control-of-flow statements, non-scalar types, and some object- oriented features. 2003 SQL:2003 SQL 2003 Introduced XML-related features, window functions, standardized sequences, and columns with auto-generated values (including identity-columns). 2006 SQL:2006 SQL 2006 ISO/IEC 9075-14:2006 defines ways in which SQL can be used in conjunction with XML. It defines ways of importing and storing XML data in an SQL database, manipulating it within the database and publishing both XML and conventional SQL-data in XML form. In addition, it enables applications to integrate into their SQL code the use of XQuery, the XML Query Language published by the World Wide Web Consortium (W3C), to concurrently access ordinary SQL-data and XML documents.[29] 2008 SQL:2008 SQL 2008 Legalizes ORDER BY outside cursor definitions. Adds INSTEAD OF triggers. Adds the TRUNCATE statement.[30] 2011 SQL:2011 http://en.wikipedia.org/wiki/SQL より
  • 11. Year Name Alias Comments 1986 SQL-86 SQL-87 First formalized by ANSI. 1989 SQL-89 FIPS 127-1 Minor revision, adopted as FIPS 127-1. 1992 1999 SQL-92 SQL:1999 SQL3 CASE Expressionrecursive queries, triggers, support for SQL2, FIPS 127-2 Major revision (ISO 9075), Entry Level SQL-92 adopted as FIPS 127-2. Added regular expression matching, Recursive Query non-scalar procedural and control-of-flow statements, non-scalar types, and some object- oriented features. 2003 SQL:2003 SQL 2003 types Introduced XML-related features, window functions, standardized sequences, and columns with auto-generated values (including identity-columns). 2006 SQL:2006 SQL 2006 ISO/IEC 9075-14:2006 defines ways in which SQL can be used in conjunction with XML. It defines ways of importing and storing XML data in an SQL database, manipulating it within the database and publishing both XML and conventional SQL-data in XML form. In addition, it enables applications to integrate into their SQL code the use of XQuery, the XML Query Language published by the World Wide Web Consortium (W3C), to concurrently access ordinary SQL-data and XML documents.[29] 2008 SQL:2008 SQL 2008 Legalizes ORDER BY outside cursor definitions. Adds INSTEAD OF triggers. Adds the TRUNCATE statement.[30] 2011 SQL:2011 http://en.wikipedia.org/wiki/SQL より
  • 13. 構造化定理 => サブクエリ • 逐次 WITH句 • 分岐 • 繰り返し
  • 14. 構造化定理 => サブクエリ • 逐次 WITH句 • 分岐 => CASE式 • 繰り返し
  • 15. 構造化定理 => サブクエリ • 逐次 WITH句 • 分岐 => CASE式 • 繰り返し => 再帰クエリ
  • 19. Demo
  • 25. Demo

Editor's Notes