mysqlsqlmanagement-studio-express

There is already an object named 'vedere1' in the database


this is my code:

--Vedere care conține clienții ce au inchiriat camere:

USE Sunset

GO

CREATE VIEW  vedere1 AS

SELECT DISTINCT c.Nume AS num_client, r.Nr_camera AS camera, f.Data_emiterii, f.Suma

FROM factura f, clienti c, camera r

WHERE (f.Id_client=c.Id_client) AND (r.Id_client=c.Id_client)

GO

and this is my error: There is already an object named 'vedere1' in the database

what should I do?


Solution

  • As the error message says, you are trying to create a view with a name that already exists in your database.

    If you want to modify/change it, use alter instead of create.

    If you want to create new view, change the name of the view.