Media Item ID versus File Path - Sitecore

Note that the MediaRelativeFilePath column is relative to the website root.

select 
     MediaItemID           = f.ItemId
    ,MediaRelativeFilePath = f.Value
    ,MediaItemPath         = t.ItemPath
from 
    dbo.ItemTree t
    
    inner join dbo.Fields f
        on t.ID = f.ItemId
        and f.FieldId = '2134867A-AC67-4DAC-836C-A9264FD9D6D6'
        
where 1=1
    and t.ItemPath like '/sitecore/media library/%'
    and t.TemplateID <> 'FE5DD826-48C6-436D-B87A-7C4210C7413B' -- exclude folder