How do MySQL views work?

后端 未结 3 1137
野性不改
野性不改 2020-12-03 09:56

When I create a view I am basically making a new table that will automatically be transacted upon when data in one of the tables it joins changes; is that correct?

A

3条回答
  •  旧时难觅i
    2020-12-03 10:09

    The difference is :

    for view you can only have subqueries in the where - part, not in the from - part so a

    CREATE VIEW v AS SELECT * FROM foo WHERE id IN (SELECT id FROM bar) 
    

    would work - but at the same time you get a read-only view ... A simple view on a single table would allow to update "through" the view to the underlying table

提交回复
热议问题