With Check Option

In this lesson we will learn how to use the WITH CHECK OPTION clause to ensure consistency of data.

We'll cover the following

WITH CHECK OPTION

Views usually contain a subset of rows from a base table. It is possible to insert or update rows which are not visible through the view. The WITH CHECK OPTION clause is used at the time of creation of the view and is used to maintain consistency when updating a table through an updatable view. This clause forbids the user to insert or update rows that are not visible through the view.

Syntax

CREATE [OR REPLACE] VIEW view_name AS

select_statement

WITH CHECK OPTION;

Connect to the terminal below by clicking in the widget. Once connected, the command line prompt will show up. Enter or copy and paste the command ./DataJek/Lessons/43lesson.sh and wait for the MySQL prompt to start-up.

Get hands-on with 1400+ tech skills courses.