mirror of
https://github.com/Phundrak/georm.git
synced 2025-08-31 14:45:36 +00:00
13 lines
421 B
MySQL
13 lines
421 B
MySQL
|
CREATE TABLE products (
|
||
|
-- strictly autogenerated
|
||
|
id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||
|
-- auto-generated but allows manual override
|
||
|
sku_number INTEGER GENERATED BY DEFAULT AS IDENTITY,
|
||
|
|
||
|
name VARCHAR(100) NOT NULL,
|
||
|
price DECIMAL(10, 2) NOT NULL,
|
||
|
discount_percent INTEGER DEFAULT 0 NOT NULL,
|
||
|
|
||
|
final_price DECIMAL(10, 2) GENERATED ALWAYS AS (price * (1 - discount_percent / 100.0)) STORED
|
||
|
);
|