0

i have 2 tables

table.employees

        id, first_name, last_name, post

table.time

        employee_id, work_time

VIEW

        id, first_name, last_name, work_time

how i can write one insert for VIEW !!?

Sezar
  • 11
  • 3
  • I don't think you can do that with MySQL. –  Sep 23 '14 at 09:14
  • 3
    Does this answer your question? [Is it possible to insert data into a MySQL view?](https://stackoverflow.com/questions/3825941/is-it-possible-to-insert-data-into-a-mysql-view) – atan Sep 03 '20 at 11:32

1 Answers1

2

You can't. It's not (always) possible to determine which values would need to be inserted. For example, your view doesn´t have the post column, which might be required, which would make it impossible to insert through a view.

As such, VIEWS are for viewing content only; insertions have to be made on the actual database tables.

Erik
  • 1,057
  • 7
  • 11