advertisement

MySQL Views

67 %
33 %
advertisement
Information about MySQL Views
Technology

Published on October 7, 2013

Author: reggieniccolosantos

Source: slideshare.net

Description

MySQL Views
- Definition
- Restrictions
- Syntax
- Example
- Advantages and disadvantages
advertisement

MySQL Views Reggie Niccolo Santos UP ITDC

Outline  What is a view?  Restrictions when using views  Syntax  Sample CREATE VIEW statement  Advantages and disadvantages of using views

What is a view?  Virtual table based on the result-set of an SQL statement  The fields in a view are fields from one or more real tables in the database

Restrictions on views  The SELECT statement cannot contain a subquery  The SELECT statement cannot refer to system or user variables  Any table or view referred to in the definition must exist

Restrictions on views  A temporary VIEW cannot be created  A VIEW cannot be associated with a trigger

Syntax: CREATE VIEW CREATE [OR REPLACE] [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}] [DEFINER = { user | CURRENT_USER }] [SQL SECURITY { DEFINER | INVOKER }] VIEW view_name [(column_list)] AS select_statement [WITH [CASCADED | LOCAL] CHECK OPTION]

Example: View CREATE OR REPLACE VIEW `view_track_details` AS SELECT TRK.id, TRK.title AS 'track_title', TRK.rating, TRK.len AS 'length', TRK.count AS 'play_count', ALB.title AS 'album_title', ART.`name` AS 'artist', GNR.`name` AS 'genre' FROM track TRK JOIN album ALB ON TRK.album_id = ALB.id JOIN artist ART ON ALB.artist_id = ART.id JOIN genre GNR ON TRK.genre_id = GNR.id;

“Avie w is no thing m o re than a pse udo -table do ing the wo rk o f a de fine d q ue ry. ”

Advantages and disadvantages Advantages:  Easily maintainable pseudo-tables of data  Added level of security by not exposing the table structure of the application Disadvantages:  Performance hit

Advantages and disadvantages Advantages:  Easily maintainable pseudo-tables of data  Added level of security by not exposing the table structure of the application Disadvantages:  Performance hit

References  http://www.w3schools.com/sql/sql_view.asp  Http://net.tutsplus.com/tutorials/databases/introdu  Http://zetcode.com/databases/mysqltutorial/views

Add a comment

Related presentations

Presentación que realice en el Evento Nacional de Gobierno Abierto, realizado los ...

In this presentation we will describe our experience developing with a highly dyna...

Presentation to the LITA Forum 7th November 2014 Albuquerque, NM

Un recorrido por los cambios que nos generará el wearabletech en el futuro

Um paralelo entre as novidades & mercado em Wearable Computing e Tecnologias Assis...

Microsoft finally joins the smartwatch and fitness tracker game by introducing the...

Related pages

MySQL :: MySQL 5.0 Reference Manual :: 18.4 Using Views

Views (including updatable views) are available in MySQL Server 5.0. Views are stored queries that when invoked produce a result set. A view acts as a ...
Read more

MySQL :: MySQL 5.7 Reference Manual :: 13.1.17 CREATE VIEW ...

At view definition time, the view creator must have the privileges needed to use the top-level objects accessed by the view.
Read more

MySQL Views Tutorial

In this tutorial, you are going to learn about MySQL View. We will explain how MySQL implements views.
Read more

MySQL Create View tutorial with examples

In this tutorial, you will learn how to create views in MySQL by using CREATE VIEW statement.
Read more

MySQL Tutorial 2: Views and Joins - arachnoid.com

Let's create a view that defines a group called "youngsters". Start a MySQL command-line session as explained on the earlier page, and make these entries:
Read more

An Introduction to MySQL Views - Techotopia

All views are the result of an underlying SELECT statement. Sometimes it can be useful to find out what the SELECT statement behind a view looks like.
Read more

php MySQL - Views - PHP Scripte und PHP Tutorials und ...

Hallo, ein View in MySQL kannst du dir als eine Art gespeicherte Abfrage vorstellen. Das dürfte schon einige Fragen klären: Sie sind immer so aktuell wie ...
Read more

MySQL Views - SitePoint – Learn HTML, CSS, JavaScript ...

From my perspective, the rise of ORMs and strong MVC mentality has made views largely unnecessary. For instance, as to the benefits you note ...
Read more

MySQL Views - w3resource - Web development tutorials ...

MySQL Views : This article covers how to create view, alter view, drop view. Tools to create MySQL, CREATE VIEW with WHERE, AND and OR, GROUP BY, ORDER BY ...
Read more

MySQL Views | David Müller: Webarchitektur

Views sollten eigentlich jedem Webdeveloper bekannt sein, deswegen versteht sich der Post hier eher als kleiner „Reminder“. Legen wir doch direkt mit ...
Read more