Get all Site Collection in Content Database

Sometime we need to list all the site collection within the content database.
 
Below Powershell script explains  how to get the list all the site collection within the content database.
  1. Get-SPContentDatabase | %{Write-Output "- $($_.Name)”; foreach($site   
  2.   
  3. in $_.sites){write-Output $site.url}}  
 Output