CRUD processing via SQL DML statements

The following four canonical CRUD operations map directly to SQL language statements:

  • Creation is done via the INSERT statement.
  • Retrieval is done via the SELECT statement.
  • Update is done via the UPDATE statement. Some SQL dialects also include a REPLACE statement.
  • Deletion is done via the DELETE statement.

We have to note that we'll often look at literal SQL syntax with all values supplied. This is separate from SQL syntax with binding variable placeholders instead of literal values. The literal SQL syntax is acceptable for scripts; it is perfectly awful for application programming. Building literal SQL statements in an application involves endless string manipulation and famous security problems. ...

Get Mastering Object-Oriented Python - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.