Is it possible to create a mysql view and table in same name
for example i have a table hs_hr_employee i want create a view as a same name
create VIEW hs_hr_employee AS SELECT * from hs_hr_employee;
I m getting following error
#1050 - Table 'hs_hr_employee' already exists
Any help Thankful
Regards
A schema cannot contain a table and view with the same name. A CREATE VIEW statement produces an error if a table with the same name already exists in the schema.
Within a database, base tables and views share the same namespace, so a base table and a view cannot have the same name.
The name of a view must be unique, and it cannot be the same as any table or database or view's name.
Because tables and views are in the same namespace, a table and a view in the same schema cannot have the same name. However, tables and indexes are in different namespaces. Therefore, a table and an index in the same schema can have the same name.
you can't , give to view different name like
hs_hr_employee_view
from manual
Within a database, base tables and views share the same namespace, so a base table and a view cannot have the same name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With