dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Why Insert and update sql has different syntax ?

  1. #1
    Krishna Guest

    Why Insert and update sql has different syntax ?


    Hi,

    Why Insert and Update sql statements needs to be different in syntax? I really
    get frustrated when I need to generate them dynamically and do the same editing
    stuff differently for both. Won't it be really easy if preferably a) also
    become standard with each database. This way I can build these statement
    dynamically from a hash table and just plug the insert/update/where statement
    as required.

    Those who can affect the decision making on these, pls consider the extra
    effort being put by developers across the world, each time they write these
    queries.

    Insert example: Insert into department (id, name) values (1, 'dept01');
    update example: Update department set name='dept001' where id=1;

    can't one of the option would be good:
    a) Insert into department set id=1, name='dept01';
    Update department set name='dept001' where id=1;

    b) Insert into department (id, name) values (1, 'dept01');
    Update department (name) values ('dept001') where id=1;

    Thanks,

    Krishna Baderia
    San Onofre Nuclear Generating Station, CA

  2. #2
    David Satz Guest

    Re: Why Insert and update sql has different syntax ?

    the syntax for INSERT and UPDATE is an ANSI standard so it is never changing
    in any true RDBMS.
    --
    HTH,
    David Satz
    Principal Web Engineer
    Hyperion Solutions

    "Krishna" <kk@diaspark.com> wrote in message
    news:3f143e72$1@tnews.web.devx.com...
    >
    > Hi,
    >
    > Why Insert and Update sql statements needs to be different in syntax? I

    really
    > get frustrated when I need to generate them dynamically and do the same

    editing
    > stuff differently for both. Won't it be really easy if preferably a) also
    > become standard with each database. This way I can build these statement
    > dynamically from a hash table and just plug the insert/update/where

    statement
    > as required.
    >
    > Those who can affect the decision making on these, pls consider the extra
    > effort being put by developers across the world, each time they write

    these
    > queries.
    >
    > Insert example: Insert into department (id, name) values (1, 'dept01');
    > update example: Update department set name='dept001' where id=1;
    >
    > can't one of the option would be good:
    > a) Insert into department set id=1, name='dept01';
    > Update department set name='dept001' where id=1;
    >
    > b) Insert into department (id, name) values (1, 'dept01');
    > Update department (name) values ('dept001') where id=1;
    >
    > Thanks,
    >
    > Krishna Baderia
    > San Onofre Nuclear Generating Station, CA




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center