DDL, DML, and programmable objects
As a developer, you are often also responsible to create database objects. Of course, in an application, you also need to insert, update, and delete the data. In order to maintain data integrity, enforcing data complies with business rules, you need to implement constraints. In a quick review of the data definition language (DDL) and data modification language (DML) elements, the following statements are presented:
CREATEfor creating tables and programmatic objectsALTERto add constraints to a tableDROPto drop an objectINSERTto insert new dataUPDATEto change existing dataDELETEto delete the data
In a SQL Server database, you can also use programmatic objects. You can use triggers for advanced constraints or to maintain redundant data like aggregated data. You can use other programmatic objects for data abstraction, for an intermediate layer between the actual data and an application. The following programmatic objects are introduced here:
- Triggers...