'Error while creating View in SQL Database

I am working on database where I am trying to create view to get all records from Art table but i am getting error.

My SQL query for creating the view is as follows:

CREATE VIEW artInfo 
AS
    SELECT * 
    FROM art 
    WHERE artName = 'Guernica'; 
sql


Solution 1:[1]

The syntax looks fine, just check table name and column name.

CREATE VIEW artInfo AS
SELECT * 
FROM art 
WHERE artName = 'Guernica'; 

Solution 2:[2]

Your code looks fine to me. I guess this error may come from TABLE artInfo ALREADY EXISTS if you run this code more than once.

CREATE OR REPLACE artInfo AS
    SELECT * FROM art 
    WHERE artName = 'Guernica';

Otherwise, please update the error and RDBMS for your question.

Solution 3:[3]

The basic syntax for creating the view is

CREATE VIEW {viewName} AS {query}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kamran qureshi
Solution 2 Hello_World
Solution 3 Saransh Lakra