Difference Between SQL & PLSQL

Subscribe to my newsletter and never miss my upcoming articles

SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate with a database whereas PL/SQL is a combination of SQL along with the procedural features of programming languages.

What is PL/SQL

The PL/SQL stands for "Procedural Language extensions to Structured Query Language" and is the advanced version of SQL to perform more complex queries/operations on DB.

BEGIN
   DBMS_OUTPUT.PUT_LINE('Hello World!');
END;

Output

Hello World

What is SQL

Structure Query Language(SQL) is a database query language used for storing and managing data in Relational DBMS. The language was developed by IBM in 1970. It represents the set of relations (tables) in the database using DDL i.e. Data Definition Language.

SELECT COUNT(DISTINCT Country) FROM Customers;

Output

Tablename    Records
Customers    91
Categories    8
Employees    10
OrderDetails    518
Orders    196
Products    77
Shippers    3
Suppliers    29

Detailed Comparison

SQLPLSQL
Structured Query LanguageProcedural Query Language
Has no variablesHas many variables & data types
Executes single query at timeExecute block-wise
No loop and if controlHave loop, while and if controls
Declarative LanguageProcedural Langauge
Interacts with the database directlyDoesn't interact with server directly

Conclusion

SQL is a declarative language that specifies what data is needed. On the other hand, PL/SQL is a procedural language that specifies how data can be retrieved and what information is required.

StackLegacy's photo

Quite well defined I really like the quality content.

Verbe Rage's photo

Great article Well done

Mawande Matanzima's photo

Great article Rahul 👏👏 You mentioned DDL but used a 'select count ' in your example. I think 'select count ' is part of DML