currency
This commit is contained in:
23
banque.md
23
banque.md
@@ -597,10 +597,16 @@ ERROR: La somme des parts (1.1000) doit être égale à 1.0000
|
||||
|
||||
```sql
|
||||
create table currency (
|
||||
code text primary key
|
||||
"code" text primary key
|
||||
);
|
||||
```
|
||||
|
||||
```sql
|
||||
insert into currency values ('EUR');
|
||||
insert into currency values ('YEN');
|
||||
```
|
||||
|
||||
|
||||
```sql
|
||||
create table exchange_rate (
|
||||
"currency_code" text references currency(code) on delete cascade,
|
||||
@@ -610,6 +616,15 @@ create table exchange_rate (
|
||||
);
|
||||
```
|
||||
|
||||
```sql
|
||||
insert into exchange_rate values
|
||||
('YEN', '2025-11-03', 177.57),
|
||||
('YEN', '2025-11-04', 176.39),
|
||||
('YEN', '2025-11-05', 176.67),
|
||||
('YEN', '2025-11-06', 177.15),
|
||||
('YEN', '2025-11-07', 176.99);
|
||||
```
|
||||
|
||||
### 4. Les opérations et transactions
|
||||
|
||||
Implémenter les transactions et opérations.
|
||||
@@ -618,7 +633,7 @@ Implémenter les transactions et opérations.
|
||||
create table transaction (
|
||||
"id" bigint primary key generated always as identity,
|
||||
"transaction_date" timestamp default current_timestamp,
|
||||
amount decimal check (amount > 0)
|
||||
"amount" decimal check (amount > 0)
|
||||
);
|
||||
```
|
||||
|
||||
@@ -627,7 +642,7 @@ create table operation (
|
||||
"id" bigint primary key generated always as identity,
|
||||
"transaction_id" bigint references transaction(id),
|
||||
"account_id" bigint references account(id),
|
||||
amount decimal check (amount > 0),
|
||||
direction text check (direction in ('DEBIT', 'CREDIT'))
|
||||
"amount" decimal check (amount > 0),
|
||||
"direction" text check (direction in ('DEBIT', 'CREDIT'))
|
||||
);
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user