University of Melbourne · FACULTY OF INFORMATION TECHNOLOGY

INFO90002 Chap.6 SQL DDL, DML and Integrity

- one subject, every graph, every model, every mark
5 Chapters2-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 6 of 12 · INFO90002

SQL DDL, DML and Integrity

SQL DDL, DML and Integrity turns table definition, constraints and insert update delete into executable reasoning. The chapter's practical target is to encode business rules at the strongest appropriate database boundary, so every explanation should connect syntax to program state, control flow and observable output.

Treat table definition as a precise program object, not a loose label.

Identify its value or responsibility before execution, then trace what can read it, change it or depend on it. This makes hidden state changes visible before they become debugging guesses.

Use constraints to explain the program's next move. Work through one representative input by hand and name the branch, iteration or call that follows.

If the trace cannot be stated, the code may run by accident rather than by understood design.

Bring in insert update delete as the test of structure.

Compare normal, boundary and invalid inputs; state the expected behaviour first; then use the mismatch between expectation and result to localise the defect.

For the application — encode business rules at the strongest appropriate database boundary — write the smallest complete example that exposes the rule.

Explain why it works, what would break it and how the program should signal or recover from that failure.

Before running a SQL DDL, DML and Integrity example, make a trace table with the important state before and after each operation. Include the value associated with table definition, the control decision governed by constraints and the output or object affected by insert update delete.

The table turns an unexplained result into a sequence that can be tested one transition at a time.

Test three inputs: an ordinary case, a boundary case and an invalid case. State the expected result for each before execution, then compare it with what the program actually does.

A useful test of constraints isolates one rule; a test that changes several conditions at once cannot tell you which condition caused the failure.

Practise explaining the solution without reading the code.

For INFO90002, name the data representation, the control flow, the responsibility of each function or class and the reason the chosen design supports encode business rules at the strongest appropriate database boundary.

This rehearsal is especially important when a written test or interview asks why the program works rather than whether it produces one correct output.

A complete SQL DDL, DML and Integrity response should make the task visible before the detail: identify what must be decided, define the relevant terms, connect the evidence to constraints, and use insert update delete to test the result.

The final sentence should answer the question actually asked rather than merely repeat the topic.

The controlling limit is specific: Application validation alone does not protect all database writers.

Keep that limit beside the worked example, because it separates a careful INFO90002 answer from one that sounds confident but claims more than the task or evidence supports.

For revision, retrieve table definition, constraints and insert update delete without notes, explain their relationship aloud, then complete a changed version of the application: encode business rules at the strongest appropriate database boundary.

Record the first point at which your reasoning fails and repair that move before attempting another case.

In this chapter

What this chapter covers

  • 01

    table definition

  • 02

    constraints

  • 03

    insert update delete

  • 04

    Applying table definition

  • 05

    Limits of constraints and insert update delete

Worked example · free

Worked example: SQL DDL, DML and Integrity

Q [4 marks]. Build a response that will encode business rules at the strongest appropriate database boundary. Give table definition, constraints and insert update delete separate jobs, then keep the final claim inside the chapter boundary. This is AskSia-authored practice, not a University question or marking scheme.
  • 1Use table definition to fix the object, category or condition being analysed in SQL DDL, DML and Integrity.
  • 1Use constraints to write the mechanism or rule that changes the starting condition.
  • 1Use insert update delete for a consequence, counter-case or check that could alter the result.
  • 1Give the requested conclusion without crossing this limit: Application validation alone does not protect all database writers.
The response assigns table definition to the object being analysed, constraints to the mechanism or rule, and insert update delete to a consequence or check. Those jobs make the reasoning inspectable rather than a list of terms. The final claim remains subject to this boundary: Application validation alone does not protect all database writers.
Sia tip — Encode domain, key and referential rules as database constraints when every writer must obey them. Application validation can improve messages, but another client can bypass it during INSERT, UPDATE or DELETE.
Glossary

Key terms

DDL, DML and DCL (CREATE/DROP/ALTER vs SELECT/INSERT/UPDATE/DELETE vs GRANT/REVOKE)
DDL defines database structures with commands such as CREATE, ALTER and DROP; DML queries or changes data with SELECT, INSERT, UPDATE and DELETE; DCL manages privileges with GRANT and REVOKE. In this chapter, use the concept when you encode business rules at the strongest appropriate database boundary.
conceptual, logical and physical design (the database development lifecycle)
Conceptual design models business entities and relationships independently of technology, logical design translates them into a data model and constraints, and physical design specifies storage, indexes and implementation details. In this chapter, use the concept when you encode business rules at the strongest appropriate database boundary.
transactions, concurrency and locking
A transaction is a logical unit of database work that should satisfy ACID properties; concurrency control and locking coordinate simultaneous transactions to prevent inconsistent or lost updates. In this chapter, use the concept when you encode business rules at the strongest appropriate database boundary.
FAQ

SQL DDL, DML and Integrity FAQ

What is the main task in SQL DDL, DML and Integrity?

Encode business rules at the strongest appropriate database boundary.

How do table definition and constraints work together?

Use table definition to establish the object or condition, then use constraints to explain how it changes the outcome being analysed.

What must a INFO90002 answer qualify here?

Application validation alone does not protect all database writers.

How should I revise SQL DDL, DML and Integrity?

Retrieve table definition, constraints and insert update delete, apply them to a changed case, and correct the first point where the evidence no longer supports the conclusion.

Study strategy

Exam move

Reconstruct the relationship among table definition, constraints and insert update delete; complete the chapter application without notes; then test the result against this limit: Application validation alone does not protect all database writers.

Working through SQL DDL, DML and Integrity in INFO90002? Sia is AskSia’s AI Information Technology tutor — ask any INFO90002 SQL DDL, DML and Integrity question and get a clear, step-by-step explanation grounded in how INFO90002 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.

A+Everything unlocked
Unlocks this Bible + all 126 of your University of Melbourne subjects - and 1,000+ Bibles across every Australian university.
Sia - your INFO90002 tutor, unlimited, worked the way the exam marks it
The full 2-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$0.99 Trial
30-day money-back · cancel in one tap · how it works