{"id":13795,"date":"2023-12-29T01:42:22","date_gmt":"2023-12-29T08:42:22","guid":{"rendered":"https:\/\/www.mysqltutorial.org\/?page_id=13795"},"modified":"2024-01-05T20:16:00","modified_gmt":"2024-01-06T03:16:00","slug":"mysql-updatable-views","status":"publish","type":"page","link":"https:\/\/www.mysqltutorial.org\/mysql-views\/mysql-updatable-views\/","title":{"rendered":"Create MySQL Updatable Views"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, we will show you how to <strong>create an updatable view<\/strong> and update data in the underlying table through the view<strong>.<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction to MySQL updatable views<\/h2>\n\n\n\n<p>In MySQL, views are not only\u00a0queryable but also\u00a0updatable. This implies that you can use the <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-insert\/\">INSERT<\/a> or\u00a0<a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-update\/\">UPDATE<\/a> statement to add or\u00a0modify rows of the base\u00a0table through the updatable view. <\/p>\n\n\n\n<p>Additionally, you can use the <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-delete\/\">DELETE<\/a> statement to remove rows of the underlying table via the view.<\/p>\n\n\n\n<p>However, to create an updatable view, the <a title=\"MySQL Select\" href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-select-from\/\">SELECT statement<\/a> defining the view\u00a0must not contain any of the following elements:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/\">Aggregate functions<\/a>&nbsp;such as <a href=\"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-min\/\">MIN<\/a>, <a href=\"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-max-function\/\">MAX<\/a>, <a href=\"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-sum\/\">SUM<\/a>, <a href=\"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-avg\/\">AVG<\/a>, and&nbsp;<a href=\"https:\/\/www.mysqltutorial.org\/mysql-aggregate-functions\/mysql-count\/\">COUNT<\/a>.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-distinct\/\">DISTINCT<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-group-by\/\">GROUP BY<\/a> clause.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-having\/\">HAVING<\/a> clause.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-union\/\">UNION<\/a> or UNION ALL clause.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-left-join\/\">Left join<\/a> or outer join.<\/li>\n\n\n\n<li><a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-subquery\/\">Subquery&nbsp;<\/a>in the <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-select-from\/\">SELECT<\/a> clause or&nbsp;in the <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-where\/\">WHERE<\/a> clause that refers&nbsp;to the table&nbsp;appeared&nbsp;in the FROM clause.<\/li>\n\n\n\n<li>Reference non-updatable views in the <code>FROM<\/code> clause.<\/li>\n\n\n\n<li>Use literal values.<\/li>\n\n\n\n<li>Multiple references to any column of the base&nbsp;table.<\/li>\n<\/ul>\n\n\n\n<p>If you create a view with the\u00a0TEMPTABLE algorithm, the view is not updatable.<\/p>\n\n\n\n<p class=\"tip\">Note that it is possible to create updatable views based on multiple tables using an <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-inner-join\/\">inner join<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">MySQL updatable view example<\/h2>\n\n\n\n<p>Let&#8217;s create an updatable view.<\/p>\n\n\n\n<p>First, create a view named <code>officeInfo<\/code> \u00a0based on\u00a0the <code>offices<\/code> \u00a0table in the <a href=\"https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/mysql-sample-database\/\">sample database<\/a>. The view refers to three columns of the <code>offices<\/code> table: <code>officeCode<\/code>, <code>phone<\/code>, and <code>city<\/code>.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">VIEW<\/span> officeInfo\n <span class=\"hljs-keyword\">AS<\/span> \n   <span class=\"hljs-keyword\">SELECT<\/span> officeCode, phone, city\n   <span class=\"hljs-keyword\">FROM<\/span> offices;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Second, retrieve data from the <code>officeInfo<\/code> view using the following statement:<em> <\/em><\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> * <span class=\"hljs-keyword\">FROM<\/span> officeInfo;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"289\" height=\"180\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2009\/12\/mysql-updateable-view-example.png\" alt=\"mysql updateable view example\" class=\"wp-image-3764\"\/><\/figure>\n\n\n\n<p>Third, change the phone number of the office with <code>officeCode<\/code> \u00a04\u00a0through the <code>officeInfo<\/code> view using the following\u00a0<a title=\"MySQL UPDATE\" href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-update\/\">UPDATE <\/a>statement.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">UPDATE<\/span> officeInfo \n<span class=\"hljs-keyword\">SET<\/span> \n    phone = <span class=\"hljs-string\">'+33 14 723 5555'<\/span>\n<span class=\"hljs-keyword\">WHERE<\/span>\n    officeCode = <span class=\"hljs-number\">4<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Finally, query\u00a0the data from the <code>officeInfo<\/code> \u00a0view to verify\u00a0the change:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> \n    *\n<span class=\"hljs-keyword\">FROM<\/span>\n    officeInfo\n<span class=\"hljs-keyword\">WHERE<\/span>\n    officeCode = <span class=\"hljs-number\">4<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"248\" height=\"49\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2009\/12\/mysql-updateable-view-example-with-officeInfo-View.png\" alt=\"mysql updateable view example with officeInfo View\" class=\"wp-image-3765\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Checking&nbsp;updatable view information<\/h2>\n\n\n\n<p>You can check if a view in a database is updatable by querying the <code>is_updatable<\/code> column from the views table in the <code>information_schema<\/code> database.<\/p>\n\n\n\n<p>The following query gets all views from the <a href=\"https:\/\/www.mysqltutorial.org\/getting-started-with-mysql\/mysql-sample-database\/\">classicmodels database<\/a> and shows which views are updatable.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> \n    table_name, \n    is_updatable\n<span class=\"hljs-keyword\">FROM<\/span>\n    information_schema.views\n<span class=\"hljs-keyword\">WHERE<\/span>\n    table_schema = <span class=\"hljs-string\">'classicmodels'<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"200\" height=\"111\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2009\/12\/updatable-views-information_schema.png\" alt=\"updatable views information_schema\" class=\"wp-image-3769\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Removing rows through the view<\/h2>\n\n\n\n<p>First, <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-create-table\/\">create a table<\/a> named items, <a href=\"https:\/\/www.mysqltutorial.org\/mysql-basics\/mysql-insert\/\">insert<\/a> some rows into the items table, and <a href=\"https:\/\/www.mysqltutorial.org\/mysql-views\/mysql-create-view\/\">create a view<\/a> that contains items whose prices are greater than 700.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-comment\">-- create a new table named items<\/span>\n<span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">TABLE<\/span> items (\n    <span class=\"hljs-keyword\">id<\/span> <span class=\"hljs-built_in\">INT<\/span> AUTO_INCREMENT PRIMARY <span class=\"hljs-keyword\">KEY<\/span>,\n    <span class=\"hljs-keyword\">name<\/span> <span class=\"hljs-built_in\">VARCHAR<\/span>(<span class=\"hljs-number\">100<\/span>) <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-literal\">NULL<\/span>,\n    price <span class=\"hljs-built_in\">DECIMAL<\/span>(<span class=\"hljs-number\">11<\/span> , <span class=\"hljs-number\">2<\/span> ) <span class=\"hljs-keyword\">NOT<\/span> <span class=\"hljs-literal\">NULL<\/span>\n);\n\n<span class=\"hljs-comment\">-- insert data into the items table<\/span>\n<span class=\"hljs-keyword\">INSERT<\/span> <span class=\"hljs-keyword\">INTO<\/span> items(<span class=\"hljs-keyword\">name<\/span>,price) \n<span class=\"hljs-keyword\">VALUES<\/span>(<span class=\"hljs-string\">'Laptop'<\/span>,<span class=\"hljs-number\">700.56<\/span>),(<span class=\"hljs-string\">'Desktop'<\/span>,<span class=\"hljs-number\">699.99<\/span>),(<span class=\"hljs-string\">'iPad'<\/span>,<span class=\"hljs-number\">700.50<\/span>) ;\n\n<span class=\"hljs-comment\">-- create a view based on items table<\/span>\n<span class=\"hljs-keyword\">CREATE<\/span> <span class=\"hljs-keyword\">VIEW<\/span> LuxuryItems <span class=\"hljs-keyword\">AS<\/span>\n    <span class=\"hljs-keyword\">SELECT<\/span> \n        *\n    <span class=\"hljs-keyword\">FROM<\/span>\n        items\n    <span class=\"hljs-keyword\">WHERE<\/span>\n        price &gt; <span class=\"hljs-number\">700<\/span>;\n<span class=\"hljs-comment\">-- query data from the LuxuryItems view<\/span>\n<span class=\"hljs-keyword\">SELECT<\/span> \n    *\n<span class=\"hljs-keyword\">FROM<\/span>\n    LuxuryItems;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"168\" height=\"66\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2009\/12\/luxuryitems-view.jpg\" alt=\"luxuryitems view\" class=\"wp-image-4141\"\/><\/figure>\n\n\n\n<p>Second, use the <code>DELETE<\/code>\u00a0statement to remove a row with id value 3.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">DELETE<\/span> <span class=\"hljs-keyword\">FROM<\/span> LuxuryItems \n<span class=\"hljs-keyword\">WHERE<\/span> <span class=\"hljs-keyword\">id<\/span> = <span class=\"hljs-number\">3<\/span>;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>MySQL returns a message saying that 1 row(s) is affected.<\/p>\n\n\n\n<p>Third, check the data through the view again:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> \n    *\n<span class=\"hljs-keyword\">FROM<\/span>\n    LuxuryItems;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"171\" height=\"45\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2009\/12\/MySQL-DELETE-through-View.jpg\" alt=\"MySQL DELETE through View\" class=\"wp-image-4142\"\/><\/figure>\n\n\n\n<p>Finally, query the data from the base table items to verify if the <code>DELETE<\/code> statement deleted the row.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"SQL (Structured Query Language)\" data-shcb-language-slug=\"sql\"><span><code class=\"hljs language-sql\"><span class=\"hljs-keyword\">SELECT<\/span> \n    *\n<span class=\"hljs-keyword\">FROM<\/span>\n    items;<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">SQL (Structured Query Language)<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">sql<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"173\" height=\"64\" src=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2009\/12\/Items-table.jpg\" alt=\"Items table\" class=\"wp-image-4143\"\/><\/figure>\n\n\n\n<p>The output shows that the row with id 3 was removed from the base table.<\/p>\n\n\n\n<p>In this tutorial, you have learned how to create an updatable view and modify data in the underlying table through the view.<\/p>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful? <\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"13795\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-views\/mysql-updatable-views\/\"\n\t\t\t\tdata-post-title=\"Create MySQL Updatable Views\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"13795\"\n\t\t\t\tdata-post-url=\"https:\/\/www.mysqltutorial.org\/mysql-views\/mysql-updatable-views\/\"\n\t\t\t\tdata-post-title=\"Create MySQL Updatable Views\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\n\t\t\t<button class=\"btn btn-primary wth-btn-submit\">Send<\/button>\n\t\t\t<button class=\"btn wth-btn-cancel\">Cancel<\/button>\n\t\t\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Summary: in this tutorial, we will show you how to create an updatable view and update data in the underlying table through the view. Introduction to MySQL updatable views In MySQL, views are not only\u00a0queryable but also\u00a0updatable. This implies that you can use the INSERT or\u00a0UPDATE statement to add or\u00a0modify rows of the base\u00a0table through [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":555,"menu_order":3,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-13795","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>MySQL Updatable Views<\/title>\n<meta name=\"description\" content=\"MySQL views are not only query-able but also updatable. In this tutorial, you will learn how to create updatable views in MySQL.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mysqltutorial.org\/mysql-views\/mysql-updatable-views\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL Updatable Views\" \/>\n<meta property=\"og:description\" content=\"MySQL views are not only query-able but also updatable. In this tutorial, you will learn how to create updatable views in MySQL.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mysqltutorial.org\/mysql-views\/mysql-updatable-views\/\" \/>\n<meta property=\"og:site_name\" content=\"MySQL Tutorial\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-06T03:16:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2009\/12\/mysql-updateable-view-example.png\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-views\\\/mysql-updatable-views\\\/\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-views\\\/mysql-updatable-views\\\/\",\"name\":\"MySQL Updatable Views\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-views\\\/mysql-updatable-views\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-views\\\/mysql-updatable-views\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2009\\\/12\\\/mysql-updateable-view-example.png\",\"datePublished\":\"2023-12-29T08:42:22+00:00\",\"dateModified\":\"2024-01-06T03:16:00+00:00\",\"description\":\"MySQL views are not only query-able but also updatable. In this tutorial, you will learn how to create updatable views in MySQL.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-views\\\/mysql-updatable-views\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-views\\\/mysql-updatable-views\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-views\\\/mysql-updatable-views\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2009\\\/12\\\/mysql-updateable-view-example.png\",\"contentUrl\":\"https:\\\/\\\/www.mysqltutorial.org\\\/wp-content\\\/uploads\\\/2009\\\/12\\\/mysql-updateable-view-example.png\",\"width\":289,\"height\":180,\"caption\":\"mysql updateable view example\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-views\\\/mysql-updatable-views\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL Views\",\"item\":\"https:\\\/\\\/www.mysqltutorial.org\\\/mysql-views\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Create MySQL Updatable Views\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mysqltutorial.org\\\/#website\",\"url\":\"https:\\\/\\\/www.mysqltutorial.org\\\/\",\"name\":\"MySQL Tutorial\",\"description\":\"A comprehensive MySQL Tutorial\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mysqltutorial.org\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MySQL Updatable Views","description":"MySQL views are not only query-able but also updatable. In this tutorial, you will learn how to create updatable views in MySQL.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mysqltutorial.org\/mysql-views\/mysql-updatable-views\/","og_locale":"en_US","og_type":"article","og_title":"MySQL Updatable Views","og_description":"MySQL views are not only query-able but also updatable. In this tutorial, you will learn how to create updatable views in MySQL.","og_url":"https:\/\/www.mysqltutorial.org\/mysql-views\/mysql-updatable-views\/","og_site_name":"MySQL Tutorial","article_modified_time":"2024-01-06T03:16:00+00:00","og_image":[{"url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2009\/12\/mysql-updateable-view-example.png","type":"","width":"","height":""}],"twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.mysqltutorial.org\/mysql-views\/mysql-updatable-views\/","url":"https:\/\/www.mysqltutorial.org\/mysql-views\/mysql-updatable-views\/","name":"MySQL Updatable Views","isPartOf":{"@id":"https:\/\/www.mysqltutorial.org\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-views\/mysql-updatable-views\/#primaryimage"},"image":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-views\/mysql-updatable-views\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2009\/12\/mysql-updateable-view-example.png","datePublished":"2023-12-29T08:42:22+00:00","dateModified":"2024-01-06T03:16:00+00:00","description":"MySQL views are not only query-able but also updatable. In this tutorial, you will learn how to create updatable views in MySQL.","breadcrumb":{"@id":"https:\/\/www.mysqltutorial.org\/mysql-views\/mysql-updatable-views\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mysqltutorial.org\/mysql-views\/mysql-updatable-views\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mysqltutorial.org\/mysql-views\/mysql-updatable-views\/#primaryimage","url":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2009\/12\/mysql-updateable-view-example.png","contentUrl":"https:\/\/www.mysqltutorial.org\/wp-content\/uploads\/2009\/12\/mysql-updateable-view-example.png","width":289,"height":180,"caption":"mysql updateable view example"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mysqltutorial.org\/mysql-views\/mysql-updatable-views\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mysqltutorial.org\/"},{"@type":"ListItem","position":2,"name":"MySQL Views","item":"https:\/\/www.mysqltutorial.org\/mysql-views\/"},{"@type":"ListItem","position":3,"name":"Create MySQL Updatable Views"}]},{"@type":"WebSite","@id":"https:\/\/www.mysqltutorial.org\/#website","url":"https:\/\/www.mysqltutorial.org\/","name":"MySQL Tutorial","description":"A comprehensive MySQL Tutorial","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mysqltutorial.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/13795","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/comments?post=13795"}],"version-history":[{"count":4,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/13795\/revisions"}],"predecessor-version":[{"id":14302,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/13795\/revisions\/14302"}],"up":[{"embeddable":true,"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/pages\/555"}],"wp:attachment":[{"href":"https:\/\/www.mysqltutorial.org\/wp-json\/wp\/v2\/media?parent=13795"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}