#Usage of CTEs and Views in SQL.

1 messages · Page 1 of 1 (latest)

glass craneBOT
#

@signal elbow has a question:

loctran070699

Hello everyone! I read an article about CTEs and Views in SQL a few days ago. In the real world, are they commonly used or just for special cases?
Because when I asked Claude, they said that: Many teams prefer handling complexity in application code or ORMs for better visibility and testing

#

<@&987246399047479336> please have a look, thanks.

limpid depot
#

I don't make use of views much any more, but we certainly make use of CTEs.

signal elbow
limpid depot
#

When do you use CTEs?
When they're an appropriate solution to the needs of an SQL statement. SQL offers many ways to solve problems, sometimes using a CTE is the most appropriate. I'm not sure there's a general "these situations" explanation to it though.

#

Similarly window-functions and lateral joins, and no doubt other rarer SQL features that don't immediately spring to mind.

signal elbow
#

I'm clear now, thanks so much

cold oak