--创建视图
CREATE VIEW info_view(id,name,sex,age,address)
AS SELECT id,name,sex,age,address
FROM Work_info;
--查询满足条件的数据
SELECT id,name,sex,address FROM info_info WHERE age>20;
-- 显示视图结构
SHOW CREATE VIEW info_view;
SELECT * FROM info_view;
CREATE OR REPLACE VIEW -- 修改视图
info_view(编号,姓名,性别,年龄,地址)
AS SELECT id,name,sex,age,address
FROM Work_info;
UPDATE info_view SET sex='女' WHERE id=1; -- 更新视图中满足条件的数据
MySQL视图简单操作
最新推荐文章于 2023-11-13 16:56:16 发布