logoalt Hacker News

adrian_btoday at 10:23 AM1 replyview on HN

DROP TABLE ?

Most of SQL is not imperative, but it certainly also includes some imperative commands.

Inserting a new row into an existing table is an imperative command, which may be the most frequently used of the SQL features, in certain applications concerned with recording transactions.

Only the subset of SQL that is used for queries can be said to not be an imperative programming language.


Replies

da_chickentoday at 11:17 AM

No. Standard DDL and DML are declarative in SQL, including DROP and INSERT. Those still don't tell the system how to accomplish the thing. Declarative doesn't mean idempotent, and it doesn't mean stateless.

Imperative SQL is the procedural elements that mostly do not exist at the standard level. Variables, control flow, and cursors.

show 4 replies