subquery vs derived tables

sql cast

Syntax The syntax for the CAST function is: CAST ( value AS type )

cast(click_num_str as int) as click_num

派生表需要别名,这是经常忘记的事情,需要记录和弄懂

Keep in mind that a subquery and derived tables are not the same; a derived table vs subquery comparison will show you that there are many differences between the two.

subquery

select * from tmp where a in (select a from xxx)

derived tables

select count(1) from (select * from a) as t

在这里插入图片描述

posted @ 2022-12-11 10:44  叶常落  阅读(0)  评论(0编辑  收藏  举报  来源