what is the command used to define view in sql

    What is the Command used to Define View in SQL?

    Table of Contents

    The CREATE VIEW  statement is used to create a view using one one or more source tables.

    The select statement define the rows and columns that need to be displayed in the view.The statement can take one or more tables and also other views.

    SYNTAX:

    CREATE VIEW ViewName

    AS

    SELECT COLUMN1,COLUMN2 FROM TABLE NAME

    1.Now we create a table .

    Now let’s create a view called customer on customer_master table.

    CREATE VIEW CUSTMASTER

    AS

    SELECT * FROM CUSTOMER_TABLE

    OUTPUT:

    CUSTID    CUSTNAME

    1                            PRAVEENA

    2                            KAVIYA

    3                            BANU

    4                            REETHU

    5                            GANESH

    NEXT WE  have create a Item Master Table.

    output:

    ITEMID  ITEMNAME

    1            COMPUTER

    2            LAPTOP

    3            MOBILE

    4            TABLET

    5            MOUSE

    last one we have create a order master table.

    Now we have a create a view using three table using inner join.

    Now let’s create a view called VIEWMASTER USING where condition.

    Conclusion

    I hope you found this article about what is the command used to define the view in sql.

    Now I’d like to hear what you have to say:

    What topic i would like to cover in my future

    Let me know by leaving a comment below.

    You can check my previous blog which is about How to Get Even Numbers in SQL

    Sign up now to receive our monthly newsletter.
    We promise to not use your email for spam!

    Leave a comment on this post

    Latest Posts