Wednesday 16 December 2020

What is SQL and why you need SQL? | Type of SQL | Introduction to SQL | Structured Query Language (SQL) Example - Quick Guide.

SQL stands for Structured Query Language.

SQL - Structured Query Language. 

COBOL+DB2 application program uses SQL statements. These SQL statements are used to select, insert, update, and delete data from the DB2 tables. These SQL statements must be embedded into the host language programs such as COBOL, JAVA, or REXX.

Welcome to today's session on "Structure Query Language (SQL)". In this session, discover what is SQL statements and why you need them in your COBOL+DB2 application programs. Learn why you need DB2 pre-compilation for COBOL+DB2 programs. So, without wasting any time let's get started with today's SQL tutorial. 

 Agenda. 

  • What is Data and why it is important?
  • What is SQL and why you need it?
  • Features of SQL ( ie. Structure Query Language).
  • What is the difference between SQL and Host language? 
  • What are the different types of SQL statements?
  • SQL statements examples. 


What is Data and why it is important?

Data is a collection of facts, that computers can understand and process. So, when you book your flight or pay utility bills, or share photographs on the social media platform. 

Your action generates tons of data. Different storage mediums such as databases, file systems, etc. store generated data for processing. Large-scale enterprise applications generally use the database to store this valuable information. 

Proper storage and analysis of data not only improve the process but also boost profit. 

Now, the question is how to store and access data from the database. The answer is SQL or structured query language. 

An Overview of SQL.

The term SQL stands for "Structured Query Language". it's popularly known as "SQL" or "SEQUEL" or “ESS-CUE-EL”. SQL is a powerful data manipulation tool that is supported by all the leading RDBMS products such as DB2, MS SQL Server, Oracle, MYSQL, etc.

"SQL is the language that communicates with the database." 

The programmer uses SQL statements to specifies what data to be fetched or updated, but does not specifies how to perform the operation. DBMS parse and analyze the SQL statement to find the optimal path to retrieve data from the tables. 

Features of SQL.

SQL is not just a query language but it's the complete package in itself. The structured query language (SQL) provides all most all features of a high-level programming language such as JAVA, COBOL, REXX, C++, etc. In fact, users can easily manipulate data without writing a huge chunk of code. Following are a few salient features of SQL. 
  • SQL is simple and easy to use. 
  • SQL is flexible and portable. 
  • SQL statements are used to retrieve data instead of lengthy code. 
  • SQL is a free-form structure. 

What is the difference between SQL and Host language?

A high-level programming language such as COBOL, JAVA, REXX, etc. is designed to processing one record-at-a-time. However, SQL is designed to process a set of records at-a-time. In set-level processing, all operations applied on the set and the output is a set of records. But, sometimes the result set can be an empty or single row. 

Host languages such as COBOL, JAVA, REXX, etc. can not handle many records in a single request. Thus, in the COBOL-DB2 or JAVA-DB2 application, you need a DB2 cursor and host variables to process many records.

SQL, Structured query language
SQL vs Host language.

Let's talk about the different types of SQL statements. 

What are the different types of SQL statements?

There are no specific criteria for categorizing SQL statements. SQL statements are generally categorized into two categories.

    - SQL Functionality.
    - SQL Execution.

The two categorized further sub-divided into many categories. Let's look at each of them one by one. 

Based on the Functionality the SQL statements are of three types: 
  1. Data Control Language (DCL): Control the user access to data. SQL statements such as Grant/Revok are used to grant or revoke user access to the data. 
  2. Data Manipulation Language (DML): Maniulupate data stored in the database tables. SQL statements such as Select, Insert, Update, and Delete is used to perform various data manipulation operations. 
  3. Data Definition Language (DDL): Create data objects such as tables, views, etc. SQL statements such as Create table, Drop table is used to create database objects.

SQL Types, Type of SQL statements

Type of SQL Statements.



Based on the Execution the SQL statements are of two types:
  1. Static SQL or Embedded SQL statements: These SQL statements are hardcoded into application programs such as COBOL+DB2.  
  2. Dynamic SQL statements: These SQL statements are prepared by the application program during the run-time.    

SQL statements examples.


Following are some SQL statement examples. 





What is SQL and why you need SQL?

This SQL tutorial is linked to a YouTube video for better understanding. Please do visit and consider subscribing to my channel. 


Conclusion. 

In this SQL tutorial, you'll why is SQL and why you need it. You also learn the basics of SQL, type of SQL statements based on functionality and execution. Followed by SQL examples for better understanding. 

►Subscribe to Topictrick & Don't forget to press THE BELL ICON to never miss any updates. Also, Please visit below mention the link below to stay connected with Topictrick and the Mainframe forum on - 

► Youtube
Facebook 
Reddit

Thank you for your support. 
Mainframe Forum™

No comments:

Post a Comment

New In-feed ads