Write SQL query to solve given problem: Average cost of purchase orders made during the first six months of 2012.. Keep the solution inside sql tag ```sql [SQL-Query] ```
SELECT CAST(SUM(ActualCost) AS REAL) / COUNT(TransactionID) FROM TransactionHistoryArchive WHERE TransactionType = 'P' AND TransactionDate >= '2012-01-01' AND TransactionDate < '2012-07-01'