Q:

Where in the database do I find channel_short_name

I'm trying to write a custom SQL query like this:
{exp:query sql="
    SELECT channel_short_name
    FROM what_table_is_it_in
    WHERE entry_id = '{embed:entry_id}'"
}
{channel_short_name}
{/exp:query}

It's inside an embed template with an entry_id passed in as {embed:entry_id}. I just need it to output the channel short name for that channel of that entry.
What database table is this in? I can't find it!
I'm trying to replicate the example at the very bottom of this page: http://www.solspace.com/docs/rating/entries/ except I want to get channel_short_name instead of entry title.

A:

Channel titles are stored in the (exp_)channels table in the channel_name column, so you'll have to do a join to get the information you need.
{exp:query sql="SELECT c.channel_name as channel_shortname FROM exp_channels as c LEFT JOIN exp_channel_titles as ct on c.channel_id = ct.channel_id WHERE ct.entry_id = '14'"}
    {channel_shortname}
{/exp:query}

In this case, I would use a regular channel entries loop instead of a query loop. I don't think it would produce much more queries if you disable everything.
{exp:channel:entries disable="categories|category_fields|custom_fields|member_data|pagination" entry_id="{embed:entry_id}" limit="1" dynamic="no"}
    {channel_short_name}
{/exp:channel:entries}

