4 ms·
Since a lot of people are thinking about this: Is there a good way to compose SQL? I see a bunch of repeated items in many SQL queries, things that would be fu
by csours 10y ago
Since a lot of people are thinking about this: Is there a good way to compose SQL?
I see a bunch of repeated items in many SQL queries, things that would be functions in another language.
One of my colleagues pointed out that this is indicative of poorly formed queries. What do you all think?
- combatentropy 10y agoIt is very likely that repetitive SQL could be helped by views (database views, not views in the MVC sense). Database views are just named queries: create view red_shirts as select * from shirts where color = 'red' ; Then you can just say: select * from red_shirts; This is a simple example. Views are normally much more intricate and useful. Basically any select-statement could be saved as a view. Databases also let you define functions.