Oct 16, 2024
Transactions
table with the following columns:
transaction_id
: Integer, set as the primary key.amount
: Decimal, with a max size of five digits and a precision of two.transaction_id
values.transaction_id
column.ALTER TABLE <table_name> ADD CONSTRAINT <constraint_name> PRIMARY KEY (<column_name>);
transaction_id
values.transaction_id
: 1000, amount
: $4.99transaction_id
: 1001, amount
: $2.89transaction_id
: 1002, amount
: $3.38transaction_id
results in an error: Duplicate entry for key transactions.primary
.transaction_id
set to null results in an error: Column transaction ID cannot be null.
SELECT amount FROM transactions WHERE transaction_id = <value>
.