- Functions SUM, AVG, MIN, MAX, COUNT are supported
-
Select count(SKU)
From SKU_DATA;
Select sum(ExtendedPrice)
From ORDER_ITEM
Where OrderNumber=1000;
- The as option allows us to name the new column
Select sum(ExtendedPrice) as TotalPrice
From ORDER_ITEM
Where OrderNumber=1000;
- You can do several of these at once:
Select sum(ExtendedPrice) as ExtendedPrice,
count(OrderNumber),
avg(Quantity),
sum(Quantity)
From ORDER_ITEM
Where OrderNumber=1000;
- Count can use a *, and disticnt may be necessairy
-
Select count(Department)
From SKU_DATA;
Select count(Distinct Department)
From SKU_DATA;
- String operations seem to be less standard.
- mysql has a huge list
-
Select concat_ws(" in ", Buyer, Department)
From SKU_DATA;
-
Select Buyer, locate("D",Buyer)
From SKU_DATA;