86, 103, 108 to 110, 124, 122, 133, 131 and 138 to 145. He is also credited with Psalms for which he is not specifically noted as the author, chief among these is Psalm 119). You will note that in many cases David seems angry with God and tells Him so. But then halfway through the psalm David begins to praise God. There is a lesson there.
But David was a man. He took more wives than he should have. He murdered Uriah to cover up his adulterous affair with Bathsheba. You may have done some stuff of which you are ashamed but I would bet David has you beat in the sin department. The result of the affair with Bathsheba was a son whom the Lord took.
But then we read one of the more amazing passages in the Word of God, 2 Samuel 12:21. David and Bathsheba have another son, and the Lord loved him. Think of all of the mess that David made. Based on what Christ said in Matthew 5:31 – 32, this is technically still an adulterous relationship, but God loved the son that was born out of this sin. So much that He had Nathan tell David to name the boy, Jedidiah, beloved of the Lord.
David, the man who is described as one after the heart of God, a flawed human. God, one who loves those who are flawed. This is a great story in which we get to participate.