Difference between Static and Dynamic SQL Last Updated : 09 Nov, 2022 Comments Improve Suggest changes 22 Likes Like Report Static or Embedded SQL are SQL statements in an application that do not change at runtime and, therefore, can be hard-coded into the application. Dynamic SQL is SQL statements that are constructed at runtime; for example, the application may allow users to enter their own queries. Dynamic SQL is a programming technique that enables you to build SQL statements dynamically at runtime. You can create more general purpose, flexible applications by using dynamic SQL because the full text of a SQL statement may be unknown at compilation. Static SQL are faster and more efficient while dynamic SQL is less efficient since access plans for dynamic statements are generated at run-time so they must be prepared in the application, and this is something you will never look at in the static SQL, but these are not the only differences between them, so we can say that dynamic SQL has only one advantage over static statements which can be clearly noticed once the application is edited or upgraded, so with Dynamic statements there's no need for pre-compilation or re-building as long as the access plans are generated at run-time, whereas static statements require regeneration of access plans if they were modified, in addition to the fact that Dynamic SQL requires more permissions, it also might be a way to execute unauthorized code, we don't know what kind of users we'll have, so for security it can be dangerous if the programmer didn't handle it. Below mentioned are the basic differences between Static or Embedded and Dynamic or Interactive SQL:Limitation of Dynamic SQL: We cannot use some of the SQL statements Dynamically. Performance of these statements is poor as compared to Static SQL. Limitations of Static SQL: They do not change at runtime thus are hard-coded into applications. Create Quiz Comment A akanshgupta Follow 22 Improve A akanshgupta Follow 22 Improve Article Tags : SQL Explore BasicsWhat is SQL?6 min readSQL Data Types3 min readSQL Operators4 min readSQL Commands | DDL, DQL, DML, DCL and TCL Commands4 min readSQL Database Operations3 min readSQL CREATE TABLE3 min readQueries & OperationsSQL SELECT Query3 min readSQL INSERT INTO Statement4 min readSQL UPDATE Statement3 min readSQL DELETE Statement3 min readSQL - WHERE Clause2 min readAliases in SQL2 min readSQL Joins & FunctionsSQL Joins (Inner, Left, Right and Full Join)4 min readSQL CROSS JOIN1 min readSQL | Date Functions3 min readSQL | String functions6 min readData Constraints & Aggregate FunctionsSQL NOT NULL Constraint2 min readSQL PRIMARY KEY Constraint5 min readSQL Count() Function4 min readSQL SUM() Function2 min readSQL MAX() Function3 min readAVG() Function in SQL2 min readAdvanced SQL TopicsSQL Subquery5 min readWindow Functions in SQL6 min readSQL Stored Procedures7 min readSQL Triggers5 min readSQL Performance Tuning6 min readSQL TRANSACTIONS6 min readDatabase Design & SecurityIntroduction of ER Model9 min readIntroduction to Database Normalization6 min readSQL Injection11 min readSQL Data Encryption5 min readSQL Backup4 min readWhat is Object-Relational Mapping (ORM) in DBMS?7 min read Like