1 / 19

SQL

SQL. Seminar Programmiersprachen – FG Praktische Informatik Pablo Pinés León . Introduction . SQL is a language for managing data in RDBMS SQL stands for Structured Query Language Originally called SEQUEL

kelton
Télécharger la présentation

SQL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SQL SeminarProgrammiersprachen – FG PraktischeInformatik Pablo Pinés León

  2. Introduction • SQL is a language for managing data in RDBMS • SQL stands forStructuredQuery Language • Originallycalled SEQUEL • Basedon Edgar Codd’sRelational Model, whichhadattracted a lot of attention at that time • Currentlywidelyused • First experimental implementation: System R, by IBM • Firstcommercialimplementation: Oracle

  3. Initial objectives of design • Language based on common english, easy to write, based in tables • Procedural, but avoiding some mathematical concepts • High level querying concepts, as grouping

  4. Initial objectives of design • More functionality: data management not relying solely on database administrators • It should serve both as query language and as a development language • Unique opportunity: free from backward compatibility

  5. Evolution of System R • Name changed • New facilities: Join, having • Null values, three-value logic • New predicates: Like • Pragmatic decisions

  6. Subsets • DML - Data Manipulation Language • Insert, Merge, etc • Transactions • DDL – Data Definition Language • Create, Drop, etc

  7. 99 bottles of beer SELECT CASE (bottlecount) WHEN 0 THEN 'No more bottle of beer on the wall, no more bottles of beer. ' || 'Go to the store and buy some more, 99 bottles of beer on the wall.' WHEN 1 THEN '1 bottle of beer on the wall, 1 bottle of beer. ' || 'Take one down and pass it around, no more bottles of beer on the wall.' WHEN 2 THEN '2 bottles of beer on the wall, 2 bottles of beer. ' || 'Take one down and pass it around, 1 bottle of beer on the wall.' ELSE rtrim (cast((BottleCount) as char(2))) || ' bottles of beer on the wall, ' || rtrim (cast((BottleCount) as char(2))) || ' bottles of beer. ' || 'Take one down and pass it around, ' || rtrim (cast((BottleCount)-1 as char(2))) || ' bottles of beer on the wall.' END FROM ( SELECT avalue * 10 + bvalue as bottlecount FROM (VALUES (9), (8), (7), (6), (5), (4), (3), (2), (1), (0)) a(avalue), (VALUES (9), (8), (7), (6), (5), (4), (3), (2), (1), (0)) b(bvalue) ) as valuelist;

  8. Biographies

  9. Don Chamberlin • Born in 1944 in San José, USA • M.Sc and PhD in electrical engineering by Stanford University. Minored in computer science • Worked for IBM Research, last years in Almaden • XQuery • He was awarded by the ACM in 1988

  10. Ray Boyce • Born in 1947 in New York • PhD in Computer Science at Purdue • Worked in Yorktown Heights for IBM => Boyce-Codd Normal Form • He moved to San Jose to work with Don Chamberlain • Died of brain aneurysm in 1974

  11. Interview

  12. Basis • Important for any language: Well defined data model (though you can retrofit it later) • SQL is declarative: • Optimizability • Data independence • High level is easier “There was significant uncertainty about whether a declarative language as complex as SQL could be implemented with the degree of performance required for commercial applications”

  13. Concurrency in shared data • Consistency is a must • Definition of ACID properties for transactions (atomicity, consistency, isolation, durability) • Degrees of isolation (thehigherthe isolation is, thebiggerportionitmightlock up) • Sidenote: halloweenproblem

  14. Design principles • Not all of them were well observed in SQL • Closure • Completeness • Orthogonality: concepts defined independently and avoiding special rules • A expression that returns a certain type should be allows to be used in any context where that data type is expected • Consistency “I think the history of SQL illustrates the importance of having a specific set of principles that guide the process of language design”

  15. Design principles • Simplicity • Extensibility • Abstraction (data independence in DB) • Optimizability: where possible, the semantic specification should be declarative • Resilience

  16. Reasons for its sucess • Database administration tasks • Quite easy to learn • Various implementations • Interfaces with popular programming languages • ANSI and ISO standards • Propitious time “I think that the main reason for the popularity of SQL derives from the power and simplicity of Ted Codd’s relational data model”

  17. Unexpected evolution • SQL injection attacks • Now it’s an object-relational language • User-defined types and methods • They expected “casual users” to use it

  18. Any questions?

  19. Thank you!

More Related