Results 1 to 4 of 4

Thread: Views in db

  1. #1
    Join Date
    Nov 2013
    Posts
    3

    Question Views in db

    Hi everyone,

    When we have views in a database, are they produced by Data Manipulation Language?

    So do views exist by SQL?

    I am a bit confused as to what is the difference between a DML and DDL, and how views are created, please help.

  2. #2
    Join Date
    Jul 2012
    Posts
    40
    Views can be defined in DML.
    The syntax looks like this :-
    CREATE VIEW VW_NAME AS
    Select
    Field_1 AS VW_Field_name_1
    ,Field_2 AS VW_Field_name_2
    ,Field_3 AS VW_Field_name_3
    etc
    FROM Table_name

    Here's a useful link :-
    SQL CREATE VIEW, CREATE OR REPLACE VIEW, DROP VIEW Statements

    HTH

    Barry in London

  3. #3
    Join Date
    Nov 2003
    Posts
    2,935
    Quote Originally Posted by Barry in London View Post
    Views can be defined in DML.
    No.
    They are defined using DDL - Data Definition Language.

    DML is to change or retrieve data, e.g. SELECT, UPDATE, INSERT, DELETE.
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

  4. #4
    Join Date
    Jul 2012
    Posts
    40

    You are right.

    You are right.

    Barry in London

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •