Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is meant by 'query modification' as an approach to implementing views?

Tags:

sql

mysql

views

Just doing some revision, and one of the questions is:

"Explain what is meant by 'query modification' as an approach to implementing views."

Now, I'm not quite sure how to answer that... I know what views are, how to create them and why they are used etc, but what exactly does that question want to know?

like image 975
Chris Edwards Avatar asked Jan 12 '11 12:01

Chris Edwards


People also ask

What is query modification?

1. is the modification by a search of a previous query. Learn more in: Query Log Analysis for Adaptive Dialogue-Driven Search.

What view helps to do modification in the query?

To modify your query: To modify your query, you must enter Design view, the view you used when creating it. There are two ways to switch to Design view: On the Home tab of the Ribbon, click the View command. Select Design View from the drop-down menu that appears.

What are the three views of query?

These are the types of views that are defined by the users. There are two types under User Defined views, Simple View and Complex View.

How data view can be modified explain?

In Object Explorer, expand the database that contains the view and then expand Views. Right-click the view and select Edit Top 200 Rows. You may need to modify the SELECT statement in the SQL pane to return the rows to be modified. In the Results pane, locate the row to be changed or deleted.


1 Answers

This is a theoretical concept from David Meier's works on relational theory.

When you are using a view in your queries, like this:

CREATE VIEW v_filtered
AS
SELECT  *
FROM    mytable
WHERE   mycolumn = 1

SELECT  *
FROM    v_filtered
JOIN    othertable
ON      otherid = myid

, to execute your query, a database engine should be able to rewrite the query over the virtual relations (like your view) to one using the base relations, since that what is actually stored:

SELECT  *
FROM    mytable
JOIN    othertable
ON      otherid = myid
WHERE   mycolumn = 1

This process is called query modification.

like image 144
Quassnoi Avatar answered Sep 20 '22 03:09

Quassnoi