1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Help in sql queries and insert command

Discussion in 'Programming' started by zed, Nov 9, 2008.

  1. #1
    Hello,
    I am trying to create a database that will add persons details to the database.
    I had created this database structure.

    Thanks in advance for anybody who can help me to complete this database by creating insert commands and queries.
    Zed
     
    zed, Nov 9, 2008 IP
  2. Ancient Dragon

    Ancient Dragon Peon

    Messages:
    192
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Unless the db server you are using requires id field, I would not use it. Instead, use another field that has a unique value for the primary key to speed up searches and joines.

    
    IF NOT EXIST(select * from country where code = "USA")
    BEGIN
       INSERT code
       values("United States of America","USA")
    END
    
    Code (markup):
     
    Ancient Dragon, Nov 9, 2008 IP
  3. zed

    zed Member

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    43
    #3
    I designed it in mysql. If you have other idea you can design it in your way.....
     
    zed, Nov 9, 2008 IP
  4. Ancient Dragon

    Ancient Dragon Peon

    Messages:
    192
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    what you have looks ok to me, just delete the id columns and use one of the other fields for primary key if you can.
     
    Ancient Dragon, Nov 9, 2008 IP