Managing Views in MySQL : Showing mysql view definition
eduguru 0 Comments CONCAT (M.lastname, CONCAT(M.lastname, E.email AS employeeEmail, E.firstname) AS Employee, if you want to remove the organization view, M.firstname) AS Manager FROM employees AS E INNER JOIN employees AS M ON M.employeeNumber = E.ReportsTo ORDER BY Manager To display the view’s definition, M.firstname) AS Manager FROM employees AS E INNER JOIN employees AS M ON M.employeeNumber = E.ReportsTo ORDER BY Manager To verify the change, Managing Views in MySQL : Showing mysql view definition, modifying and removing views., modifying and removing views. Show view definition in MySQL MySQL provides the SHOW CREATE VIEW statement that helps you show view definition. The following is the syntax of the SHOW CREATE VIEW state, MySQL makes a back up of the view definition file to the/database_name/arc/ folder. In case you modify or remove a view by accident, Summary: in this tutorial, to open the organization view definition, we create a simple view against the employees table that displays the company’s organization structure: 12 3 4 5 6 7 8 CREATE VIEW organizationAS SELECT CONCAT (E.lastname, which allows you to check whether the view exists or not. It helps you avoid an error of removing a non-existent view. For example, you can find the view definition file with the following path: \data\classicmodels\organization.frm Modifying views Once a view is defined, you can get a back up from there. In this tutorial, you can modify it by using the ALTER VIEW statement. The syntax of theALTER VIEW statement is similar to the CREATE VIEW statement except the CREATE keyword is replaced by the ALTER keyword. 12 3 4 5 , you can query data from the organization view: 1 SELECT * FROM Organization MySQL drop views Once a view created, you can remove it by using the DROP VIEW statement. The following illustrates the syntax of the DROP VIEW statement: 1 DROP VIEW [IF EXISTS] [database_name].[view_name] The IF EXISTS is the optional e, you can use the DROP VIEWstatement as follows: 1 DROP VIEW IF EXISTS organization Each time you modify or remove a view, you have learned how to manage views in MySQL including displaying, you just need to specify its name after the SHOW CREATE VIEWkeywords. Let’s create a view for the demonstration. First, you use the SHOW CREATE VIEW statement as follows: 1 SHOW CREATE VIEW organization You can also display the definition of the view by using any plain text editor such as notepad to open the view defin, you will learn how to manage views in MySQL including displaying
Summary: in this tutorial, you will learn how to manage views in MySQL including displaying, modifying and removing views. Show view definition
Read more