EN
MySQL - how to create view only if not exists?
1 answers
0 points
How can I create a view only if it doesn't already exist in MySQL?
1 answer
0 points
I found a solution:
We can use the following syntax so we won't get errors while trying to create a view that already exists:
xxxxxxxxxx
1
CREATE VIEW IF NOT EXISTS `view_name` AS
2
SELECT `column1`, `column2`, ...
3
FROM `table_name`
4
WHERE condition;
Check the article below to see some practical examples:
0 commentsShow commentsAdd comment