If I have database D1
and database D2
, and table T1
under database D1
and table T2
under database D2
, is it possible to create a view of T1
under database D2
in MySQL. If so, can you show me the syntax.
Both the databases are on the same machine.
Yes you can - the t-sql syntax is the same as within any other cross database call (within a stored procedure for example). Show activity on this post. Show activity on this post.
SQL Server CREATE VIEW First, specify the name of the view after the CREATE VIEW keywords. The schema_name is the name of the schema to which the view belongs. Second, specify a SELECT statement ( select_statement ) that defines the view after the AS keyword. The SELECT statement can refer to one or more tables.
Views can be created from a single table, multiple tables or another view.
CREATE VIEW `D2`.`example` AS SELECT * FROM `D1`.`T1`;
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