I suppose the definition might be different for different databases (I've tagged a few databases in the question), but suppose I have the following (in pseudocode):
CREATE VIEW myview FROM SELECT * FROM mytable GROUP BY name And then I can query the view like so:
SELECT * FROM myview WHERE name like 'bob%' What exactly is the "view" doing in this case? Is it just a short-hand and the same as doing:
SELECT * FROM ( SELECT * FROM mytable GROUP BY name ) myview WHERE name like 'bob%' Or does creating a view reserve storage (or memory, indexes, whatever else)? In other words, what are the internals of what happens when a view is created and accessed?