summaryrefslogtreecommitdiff
path: root/mysql-test/main/create_drop_view.result
blob: 9d7e42552bf9f1cc3df74323d0cf065390731a0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
CREATE TABLE t1(id INT);
CREATE VIEW IF NOT EXISTS v1 AS SELECT * FROM t1 WHERE id>10;
INSERT INTO t1 VALUES (5), (8), (10), (20), (30);
SELECT * FROM t1;
id
5
8
10
20
30
SELECT * FROM v1;
id
20
30
CREATE VIEW v1 AS SELECT * FROM t1 WHERE id>11;
ERROR 42S01: Table 'v1' already exists
SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1';
VIEW_DEFINITION
select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`id` > 10
CREATE VIEW IF NOT EXISTS v1 AS SELECT * FROM t1 WHERE id>12;
Warnings:
Note	1050	Table 'v1' already exists
SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1';
VIEW_DEFINITION
select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`id` > 10
CREATE OR REPLACE VIEW IF NOT EXISTS v1 AS SELECT * FROM t1 WHERE id>13;
ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS
SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1';
VIEW_DEFINITION
select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`id` > 10
CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1 WHERE id>14;
SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME='v1';
VIEW_DEFINITION
select `test`.`t1`.`id` AS `id` from `test`.`t1` where `test`.`t1`.`id` > 14
INSERT INTO t1 VALUES (50), (80), (3), (2), (40);
SELECT * FROM t1;
id
5
8
10
20
30
50
80
3
2
40
SELECT * FROM v1;
id
20
30
50
80
40
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
Note	4092	Unknown VIEW: 'test.v1'
DROP TABLE t1;