摘要: DELIMITER $$USE `test`$$DROP VIEW IF EXISTS `test_view`$$CREATE VIEW `test_view` ASSELECT a.id,a.name,b.id bId,b.name bNameFROM testtable1 aLEFT JOIN testtable2 b ON a.id = b.id $$DELIMITER ;SELECT * FROM test_view;/*标准创建语法,中括号括起来的表示可以不写,如需写,写的时候将中括号去掉CREATE [OR REPLACE] [ALGORITHM = UNDEFINED/MERGE 阅读全文
posted @ 2012-10-24 14:35 风吹屁股凉冰冰 阅读(1100) 评论(0) 推荐(0) 编辑
摘要: DELIMITER $$DROP TRIGGER `testtable1_A_U`$$CREATE TRIGGER `testtable1_A_U` AFTER UPDATE ON `testtable1` FOR EACH ROWBEGININSERT INTO testtable2(NAME)VALUES('niu');END$$DELIMITER ;UPDATE testtable1 SET NAME='wang',age = 22 WHERE id = 23;/*DROP TRIGGER `testtable1_A_U`为删除指定触发器1.创建触发器的语 阅读全文
posted @ 2012-10-24 10:18 风吹屁股凉冰冰 阅读(424) 评论(0) 推荐(0) 编辑