14. 2. アンリーダブルSQL
select super_long_column_name a, yet_another_long_column_name
b, .. from super_long_table_name t left join more_long_long_table
_name t0 on .. where .. group by t.a, t.b order by ..
13/42
17. 2. アンリーダブルSQL
SELECT super_long_column_name AS long_column, yet_another_long_co
lumn_name ya_long_column, .. FROM super_long_table_name AS long_t
able LEFT JOIN more_long_long_table_name AS more_long ON .. WHER
E .. GROUP BY long_table.long_column, long_table.ya_long_column O
RDER BY ..
16/42
21. 4. サブクエリー忌避症候群
SELECT ..
FROM user_main
WHERE user_id IN (SELECT user_id FROM black_list) AND ..
↓
SELECT ..
FROM user_main JOIN black_list USING(user_id)
WHERE ..
20/42
26. 6. 200 Internal Server Error
return $conn->selectrow_hashref($sql, undef, @param);
my $ret;
eval
{
$ret= $conn->selectrow_hashref("SELECT COUNT(*) AS c FROM ..")-
>{c};
};
$ret= 0 if $@;
return $ret;
25/42