scusate ma è l'ultima e non mi viene, devo Calcolare lo sconto medio dei fornitori e individuare il fornitore che effettua lo sconto superiore alla media. e le tabelle prese in considerazione sono:
codice:
mysql> select * from Fornitore;
+-------------+--------------+
| Partita_IVA | Nome         |
+-------------+--------------+
| 12300000000 | Invenzione 1 | 
| 12340000000 | Invenzione 2 | 
| 12345000000 | Invenzione 3 | 
| 12345600000 | Invenzione 4 | 
| 12345670000 | Invenzione 5 | 
| 87878787878 | Invezione10  | 
+-------------+--------------+
codice:
mysql> select * from Preventivo;
+---------------+----------+--------+--------+------------+------------+
| Id_preventivo | Quantita | Prezzo | Sconto | Data       | Id_lamiera |
+---------------+----------+--------+--------+------------+------------+
| 001/9         |       50 |   3.00 |   0.20 | 2009-08-02 | 0001       | 
| 001/9         |       75 |   2.00 |   0.20 | 2009-08-02 | 0002       | 
| 001/9         |       40 |   2.00 |   0.20 | 2009-08-02 | 0003       | 
| 002/9         |       30 |   3.00 |   0.20 | 2009-08-10 | 0004       | 
| 002/9         |       80 |   2.00 |   0.20 | 2009-08-10 | 0005       | 
| 003/9         |       40 |   1.50 |   0.25 | 2009-10-15 | 0001       | 
+---------------+----------+--------+--------+------------+------------+
6 rows in set (0.00 sec)

mysql> select * from Elabora;
+-------------+---------------+------------+
| Partita_IVA | Id_preventivo | Data       |
+-------------+---------------+------------+
| 12300000000 | 001/9         | 2009-06-30 | 
| 12340000000 | 002/9         | 2009-07-05 | 
| 87878787878 | 003/9         | 2009-05-24 | 
+-------------+---------------+------------+