Coupons With an Identity Column
EasyDescription
Create a coupons table:
| column | rule |
|---|---|
| coupon_id | a whole number, numbered automatically; an id typed by hand is always refused; the primary key |
| code | text of up to 20 characters, required, and no two coupons share a code |
| discount_pct | NUMERIC(5, 2), required |
Then check the table with this query:
CodeSELECT column_name, data_type, character_maximum_length, numeric_precision, numeric_scale, is_nullable, is_identity, identity_generation FROM information_schema.columns WHERE table_name = 'coupons' ORDER BY ordinal_position;
Finish with exactly this query.
Tables
This problem only uses the table you create.