· 4 years ago · Feb 25, 2021, 08:02 AM
1CREATE TABLE IF NOT EXISTS clienti
2(
3 customer_id serial PRIMARY KEY,
4 cognome varchar(30) not null,
5 nome varchar(30) not null
6);
7CREATE TABLE IF NOT EXISTS pagamenti
8(
9 customer_id serial PRIMARY KEY,
10 importo float not null
11);
12
13insert into clienti(cognome, nome)
14values ('Rossi', 'Mario'),
15 ('Verdi', 'Giacomo'),
16 ('Bianchi', 'Alex');
17insert into pagamenti(importo)
18values (10.95),
19 (25.95);
20
21SELECT *
22from clienti as a
23 inner join pagamenti b on a.customer_id = b.customer_id and b.importo > 5;
24
25
26