You want every new row to automatically start with a monetary value of $10,000 in a particular column unless the insert specifies another value. Which column property sets this initial monetary value?

Difficulty: Easy

Correct Answer: Default value

Explanation:


Introduction / Context:
Defaults improve data consistency by supplying a value when inserts omit a column. For monetary fields, setting a sensible default can streamline data entry and ensure predictable behavior across applications and ETL jobs.



Given Data / Assumptions:

  • A monetary column should initialize to $10,000 automatically.
  • Applications may insert rows without explicitly setting this column.
  • The DBMS supports column defaults (for example, DEFAULT in CREATE/ALTER TABLE).


Concept / Approach:
The default value column property supplies an automatic value when an INSERT omits the column. In SQL, you define it as DEFAULT 10000. It does not enforce that only 10,000 is allowed; it simply initializes the value. Data type still needs to be appropriate (for example, NUMERIC(12,2)), and constraints can further limit ranges or sign.



Step-by-Step Solution:

Choose a fixed-point numeric type suitable for currency (for example, NUMERIC(12,2)).Set DEFAULT 10000.00 on the column definition.Insert a row omitting the column and verify it populates with 10000.00.


Verification / Alternative check:
Select after insert and confirm the default value appears. Override by explicitly specifying a different amount in the INSERT and confirm it respects the provided value.



Why Other Options Are Wrong:

  • Null status: Controls presence/absence, not initialization.
  • Data type: Ensures numeric format but does not set an initial value.
  • Data constraints: Enforce rules (for example, nonnegative), not initialization.
  • Identity/serial: Auto-generates surrogate keys, unrelated to currency defaults.


Common Pitfalls:
Assuming DEFAULT applies to updates—defaults are only used when the column is omitted in INSERT, not when it is set to NULL unless you also forbid NULLs.



Final Answer:
Default value

More Questions from Data Models into Database Designs

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion