Database schema: create table ItemTypes (Id integer Primary Key, Description varchar(50), Deleted INTEGER, Repairable Integer, OverridePutAwayLocationid integer FK->Locations.id);create table Transactions (ActualDepartureDate datetime, ArrivedAt datetime, BillToId integer, CreatedById integer FK->ApplicationUsers.id, CreatedOn datetime, CustomerPO varchar(20), DateRequired datetime, DisputeNotes varchar(50), FromLocationId integer FK->Locations.id, Id integer primary key, InventoryCategoryId integer FK->InventoryCategory.Id, IsEstimateFinalized integer, LocationReference integer, OriginalTransactionId integer FK->Transactions.Id, PartnerReferenceNumber varchar(20), PlannedDeliveryDate datetime, PlannedDepartureDate datetime, SalesOrder varchar(20), ShipmentId integer FK->Shipments.Id, Status integer FK->TransactionStatus.id, ToLocationId integer FK->Locations.Id, Timestamp datetime );create table TransactionLines (ActualQuantity integer, CustomerLineNumber integer, EstimatedQuantity integer, Id INTEGER PRIMARY KEY, ItemId integer FK->Items.id, PlannedQuantity INTEGER, TransactionId integer FK->Transactions.Id, ReceivedQuantity integer, RequestedQuantity integer, SalesOrderLineItem integer, UnitLoadParentId integer  );create table TransactionLineDetails ( Id INTEGER PRIMARY KEY, TransactionLineId integer FK->TransactionLines.Id, TrackedItemId integer FK->TrackedItems.Id);create table TransactionStatus (Description varchar(50),   Id integer primary key ); create table Items ( CollapsedHeight integer, Collapsible integer, CustomerItemNumber varchar(20), Height integer, Id integer primary key, FloorLocation varchar(20), FullTrailerLoad varchar(20), ImageFileName varchar(20), IsUnitLoad integer, Length integer, Name varchar(20), PalletQty integer, ShortName varchar(20), StackHeight integer,  TypeId integer FK->ItemTypes.Id, UnitCost Decimal(18,2),Weight float, Width integer ); create table Locations (CloseTime time, Deleted integer, EquipmentInspectionInterval integer, Id integer primary key, LocationNumber varchar(20), FreightCodeId integer FK->FreightCodes.id, MaxLoadPerTimeslot integer, IsOpen24Hours integer, LanguageId integer FK->Languages.Id, Name varchar(20), LastCountDate datetime, NextCountDate datetime, NonWorkingTimeSetId integer FK->NonWorkingTimeSet.Id, OpenTime time,  ProcessedPutAwayPullFromLocationId integer FK->Locations.id, ShortName varchar(20),TimeslotDuration integer, TargetDaysOnHand integer, TaxId varchar(50), TypeId integer FK->LocationTypes.Id);
Question:  what's the average quantity on shipments of totes in the last month
SQL: select avg(ActualQuantity) AvgDiff, it.name from transactions tr join TransactionLines tl on tr.id = tl.transactionid  join items it on tl.itemid = it.id join ItemTypes ity on it.TypeId = ity.id where ArrivedAt >= cast(dateadd(month, -1, getdate()) as date) and ArrivedAt <= cast(getdate() as date) and (it.name like '%tote%' or ity.Description like '%tote%')  group by it.name