# Transactions and safe querying

> A group of database operations treated as one logical unit.

Course: [SQL and relational databases](https://studybrix.com/en/courses/sql-databases/index.md)
Level: university
Prerequisites: Basic computing and simple data tables.

## Notes

### Transaction

A group of database operations treated as one logical unit.

### Parameterized query

A query that keeps data values separate from SQL syntax.

### Constraint

A database rule that rejects invalid states or values.

### Least privilege

Granting only the permissions required for a task.

## Practice questions

### 1. Which term best matches this description: A group of database operations treated as one logical unit.

A. Least privilege
B. Parameterized query
C. Transaction
D. Constraint

Answer: Transaction

Explanation: Transaction is the matching concept in this lesson.

### 2. Which term best matches this description: A query that keeps data values separate from SQL syntax.

A. Parameterized query
B. Constraint
C. Least privilege
D. Transaction

Answer: Parameterized query

Explanation: Parameterized query is the matching concept in this lesson.

### 3. Which concept would you apply first in a situation where a database rule that rejects invalid states or values.

A. Least privilege
B. Parameterized query
C. Constraint
D. Transaction

Answer: Constraint

Explanation: The scenario directly calls for Constraint.

### 4. Name the concept described as: Granting only the permissions required for a task.

Answer: Least privilege

Explanation: The intended concept is Least privilege.

### 5. Which statement about Transaction is most accurate?

A. A group of database operations treated as one logical unit.
B. A query that keeps data values separate from SQL syntax.
C. A database rule that rejects invalid states or values.
D. Granting only the permissions required for a task.

Answer: A group of database operations treated as one logical unit.

Explanation: The definition in the lesson notes gives the required condition.

### 6. Explain one important difference between Transaction and Parameterized query.

Sample answer / marking guidance: Transaction: A group of database operations treated as one logical unit. Parameterized query: A query that keeps data values separate from SQL syntax.

Explanation: Credit a clear distinction using both definitions and an appropriate example if supplied.

### 7. Give a short example showing how Constraint would be used in practice.

Sample answer / marking guidance: A valid example should demonstrate this idea: A database rule that rejects invalid states or values.

Explanation: Credit a relevant scenario that applies the concept rather than merely naming it.

### 8. Summarize why Least privilege matters in the lesson “Transactions and safe querying”.

Sample answer / marking guidance: Least privilege matters because Granting only the permissions required for a task.

Explanation: Credit the core purpose, scope and any important limitation from the notes.

## Further reading

- https://www.postgresql.org/docs/

Original AI-assisted educational draft; not independently teacher-reviewed. References support further study, not copied exercises, affiliation or curriculum accreditation.
