select pretty_name as data_type_pretty, secure_p, sort_key as data_type_sort_key
from portal_data_types
where name = :name
select pretty_name as mime_type_pretty, sort_key as mime_type_sort_key
from portal_mime_types
where name = :name
select name, pretty_name, secure_p, sort_key
from portal_data_types
order by sort_key
select name, pretty_name, sort_key
from portal_mime_types
order by sort_key
select case when owner_id = null then 1 else 0 end as default_portal_p from portals where portal_id = :portal_id
select portal_id as info_value
from portals
where package_id = :package_id and owner_id is null
select template_id from portals where portal_id = :portal_id