Db2 for z/OS & Db2ZAI

 View Only
Expand all | Collapse all

Db2 Z SQL terms

  • 1.  Db2 Z SQL terms

    Posted 30 days ago

    I am curious about the use of the SQL terms DDL,DML,DCL. These terms are widely used but if you look in the IBM Knowledge centre they are not included in the Glossary of terms or in reference to SQL. There are catalog tables and error messages that include DDL.

    Are these old school terms now or have they just been omitted from the Knowledge Centre and it should be updated? So if I asked what is DDL the KC is not going to tell me.



    ------------------------------
    CRAIG MCKELLAR
    ------------------------------


  • 2.  RE: Db2 Z SQL terms

    Posted 27 days ago

    Howzit Craig?

    I don't know about old school as I'm very young, apparently (at least my kids say I'm so immature which I take as a compliment)

    Jokes aside, I still use all 3 terms to distinguish between them, DDL, DML & DCL in order of use. Not sure about KC, it can be pretty vague but there are plenty of other references relating to SQL sub-types

    Cheers
    Bruce



    ------------------------------
    Bruce Williamson
    ------------------------------



  • 3.  RE: Db2 Z SQL terms

    Posted 26 days ago
    Edited by Paul Newton 26 days ago
    I believe the subtypes help with learning and applying sql. Especially before coding or needing to interpret complex sql statements that can totally confuse those new to sql.






  • 4.  RE: Db2 Z SQL terms

    IBM Champion
    Posted 26 days ago

    Hi Craig,

    The terms DDL, DML and DCL refers to groups of SQL commands or statements, related to their main function.

    DDL - Data Definition Language: which are the set of SQL statements used to define (create), alter and delete SQL objects, like databases, table spaces, tables, indexes, views, etc. 
      For example: CREATE TABLE, DROP, etc...

    DML - Data Manipulation Language: which are the set of SQL statements used to manipulate data within the SQL objects, particularly in tables.
      For example: SELECT, INSERT, UPDATE, DELETE, etc...

    DCL - Data Control Language: which are the set of SQL statements used to control access to the SQL objects and database management functions, like the SYSADM, SYSCTL, DBADM, etc.
      For example: GRANT, REVOKE, etc...

    This link contains an alphabetical list of the SQL statements that Db2 for z/OS® supports.

    Best regards,



    ------------------------------
    Antonio Couto
    Sr. Technical Consultant
    Broadcom
    Sao Paulo
    11940683438
    ------------------------------



  • 5.  RE: Db2 Z SQL terms

    Posted 26 days ago

    I guess the point I am highlighting here is that we are well aware of these terms but they are not actually used or referenced in the Knowledge centre and probably should be since they are well used elsewhere.

    If you look at the heading of SQL reference:

    SQL: The language of Db2

    Last Updated: 2024-05-21

    The language that you use to access the data in Db2 tables is the structured query language (SQL). SQL is a standardized language for defining and manipulating data in a relational database.

    The language consists of SQL statements. You can issue SQL statements to accomplish the following actions:

    • Define, modify, or drop data objects, such as tables.
    • Retrieve, insert, update, or delete data in tables.

    You can use other SQL statements to authorize users to access specific resources, such as tables or views.

    Note here the terms DDL or DML are not used and likewise in the Glossary of terms they are missing.  



    ------------------------------
    CRAIG MCKELLAR
    ------------------------------



  • 6.  RE: Db2 Z SQL terms

    IBM Champion
    Posted 26 days ago
    Hi Craig,
     
    Apologies for misinterpreting your comment/question.
     
    I agree with you that these terms (DDL, DML and DCL), although commonly used, are not clearly mentioned or defined in regular IBM documentation. In fact, I've only seen these terms in IBM and ISV training sessions.


    Best regards,



    ------------------------------
    Antonio Couto
    Sr. Technical Consultant
    Broadcom
    Sao Paulo
    11940683438
    ------------------------------



  • 7.  RE: Db2 Z SQL terms

    Posted 26 days ago
    Edited by Paul McWilliams 26 days ago

    Hi Craig,

    I'm looking into making some changes in the Db2 product documentation based on your feedback. 

    The SQL statement categories, like DDL, DML, and DCL have a bit of a complicated history and relationship with the Db2 product documentation.

    For one thing, although commonly known and widely used, they are informal categories (Wikipedia even says so), in that they are not defined in the SQL Standard. The standard actual sets forth its own list of statement categories, and they don't completely match with the three categories that you mentioned. For example, the GRANT and REVOKE statements appear to be grouped in with the SQL schema category, which is mainly the DDL statements. 

    Another complication is that many SQL statements do not fit neatly into DDL, DML, or DCL. Some online resources suggest that queries belong in DQL (data query language), although we'll likely consider them as DML. Others mention TCL (for transaction control language) for statements like COMMIT and ROLLBACK and SET. The SQL standard actually sets forth eight categories of SQL statements: SQL-schema, SQL-Data, SQL-control, SQL-connection, SQL-session, SQL-diagnostics, and SQL-dynamic statements. 

    Yet another consideration as that the Db2 product documentation generally tries to avoid sweeping generalizations where these terms would be useful, so it didn't seem to make much sense to define them.

    However, it's also true that they have gotten into various Db2 for z/OS externals over the years, especially DDL and DML. So it probably is worthwhile for the documentation to mention their meaning.

    I also found that both DDL and DML are defined in the Db2 (for Linux, UNIX, and Windows) glossary, so we'll likely add those to the Db2 for z/OS glossary too using the same words, which use the approved IBM-wide terminology definitions. I am also already trying to work these terms into the section that you cited above, so I will take your posting it as an indication that I am on the right track.

    Thanks for the suggestion, and stay tuned! 


    ------------------------------
    Paul McWilliams
    ------------------------------



  • 8.  RE: Db2 Z SQL terms

    IBM Champion
    Posted 26 days ago

    Hi Paul,

    Thank you for the clarification on the DDL, DML, and DCL terms history, SQL standards and documentation issues.
    You can add 1 to the "I am on the right track" counter regarding to provide a Db2 for z/OS documentation update you've mentioned.

    Best regards,



    ------------------------------
    Antonio Couto
    Sr. Technical Consultant
    Broadcom
    Sao Paulo
    11940683438
    ------------------------------



  • 9.  RE: Db2 Z SQL terms

    Posted 24 days ago

    Hi all,

    Here's a Db2 documentation update, just published today:

    • Spelled-out forms of DDL, DML, and DCL, plus "see also" entries for their abbreviations can now be found in the Db2 glossary.
    • SQL: The language of Db2 now has three bullets (versus the two bullets and a paragraph that were there before), and they each indicate that they are examples of DDL, DML, or DCL.
    • Statements now also includes that same three-bullet list.
    • Categories of SQL statements is a new topic. It features a table of all supported SQL statements organized by formal category in the left column, with text that identifies which statements are considered DDL, DML, and DCL, and mentions of some other commonly used categories, in the right column.
    • As always, the current edition of the PDF format Db2 for z/OS SQL Reference has also been updated with the applicable changes. 

    Thanks again!



    ------------------------------
    Paul McWilliams
    ------------------------------



  • 10.  RE: Db2 Z SQL terms

    Posted 24 days ago

    Hi Paul

    My curiosity is answered :) The changes you have made are way beyond of what one could have hoped for.  Thanks for this important contribution to the Db2 documentation. 



    ------------------------------
    CRAIG MCKELLAR
    ------------------------------



  • 11.  RE: Db2 Z SQL terms

    Posted 23 days ago

    Would be nice to have a SQL guide for the Db2 JDBC Drivers...

    When using the JDBC with the DRDA Servers from Oracle and Microsoft with Oracle/DB and SQL Server the SQL syntax becomes hit and miss.
    Throw in Informix with it's crazy case rules and all bets are off. Took me a while to learn what would work and not work as to the SQL Syntax supported by each of these DRDA providers. 

    Thanks for posting the current z/OS PDF. 
     

     



    ------------------------------
    Steve Able
    Director of Strategy and Architecture
    Adaptigent formally GT Software, Inc.

    ------------------------------



  • 12.  RE: Db2 Z SQL terms

    IBM Champion
    Posted 22 days ago

    Hi Paul,

    Thank you very much for updating the Db2 for z/OS documentation.
    By the way, it came out excellent! It was a very comprehensive update.
    Congratulations for great job!

    Best regards,



    ------------------------------
    Antonio Couto
    Sr. Technical Consultant
    Broadcom
    Sao Paulo
    11940683438
    ------------------------------