GROUP BY function would produce inventory totals distributed across different vendors
SQL>
SQL> CREATE TABLE MyProduct
2 (
3 MAKER VARCHAR (25),
4 MODEL VARCHAR (25),
5 PRICE NUMERIC
6 );
Table created.
SQL>
SQL> INSERT INTO MyProduct VALUES('CHRYSLER','CROSSFIRE',33620);
1 row created.
SQL> INSERT INTO MyProduct VALUES('CHRYSLER','300M',29185);
1 row created.
SQL> INSERT INTO MyProduct VALUES('HONDA','CIVIC',15610);
1 row created.
SQL> INSERT INTO MyProduct VALUES('HONDA','ACCORD',19300);
1 row created.
SQL>
SQL> INSERT INTO MyProduct VALUES('FORD','MUSTANG',15610);
1 row created.
SQL> INSERT INTO MyProduct VALUES('FORD','LATESTnGREATEST',NULL);
1 row created.
SQL> INSERT INTO MyProduct VALUES('FORD','FOCUS',13005);
1 row created.
SQL>
SQL>
SQL> SELECT
2 Maker,
3 SUM(price) total
4 FROM MyProduct
5 GROUP BY maker;
MAKER TOTAL
------------------------- --------
HONDA ########
FORD ########
CHRYSLER ########
SQL>
SQL> drop table MyProduct;
Table dropped.
SQL>
Related examples in the same category