0

I have a task to do synchronizing view with table in phpmyadmin. As example, I have a view table like this:

VIEW:

enter image description here

TABLE:

enter image description here

the data records of table is same as view. I copy the data from view to table using

CREATE TABLE tablename AS (SELECT * FROM viewname) 

I want to synchronize them. As example, when view is updated then table will be updated too. The meaning of view's updating is like editing the view then I import the view again by deleting the old one. Is there any way to do that? I want to synchronize the view and the table because the time took so long when I open the view. So I made table which is same as view so that I'm able to open it faster. Thanks in advance

11
  • What do you mean with "when view is changed"? Commented May 8, 2017 at 8:16
  • 1
    A view is a Logical view on table(s), they have no explizit data. Commented May 8, 2017 at 8:17
  • 1
    Also read this: stackoverflow.com/questions/6015175/… Commented May 8, 2017 at 8:18
  • I mean "when the view is updated" @PerEnström Commented May 8, 2017 at 8:18
  • 2
    I think you need to explain WHY you are doing this, if you indeed are copying view data from table A to a table B. Commented May 8, 2017 at 8:31

1 Answer 1

2

VIEW in MySQL is a virtual table or logical view of a table as mentioned by Jens that has no data stored on it like a table.

Instead, it fetches the values directly from the table. The values in VIEW changes when the values from the table it fetches changes.

Therefore you will need to sync between the tables and not between view and table.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.