3 ms·
It 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 vi
by combatentropy 9y ago
It 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.