How can a column in SQL be configured to automatically insert a decimal number with 2 decimal places?

To automatically insert a decimal number with 2 decimal places in a column in SQL, you can use the DECIMAL data type with precision and scale specified. By setting the scale to 2, you ensure that only numbers with 2 decimal places will be stored in the column. Additionally, you can use the ROUND function in SQL to round any incoming decimal values to 2 decimal places before insertion.

CREATE TABLE example_table (
    decimal_column DECIMAL(10, 2)
);

INSERT INTO example_table (decimal_column) VALUES (ROUND(123.456, 2));