insert Query for all cities of U.S.A

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nil81
    New Member
    • Jun 2007
    • 12

    insert Query for all cities of U.S.A

    dear friends,

    I want to make an database table which include all the cities of U.S.A
    corresponding to their states


    Can u help me to provide the ready made

    insert query for inserting cities of U.S.A having reference key as State_Id.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by nil81
    dear friends,

    I want to make an database table which include all the cities of U.S.A
    corresponding to their states


    Can u help me to provide the ready made

    insert query for inserting cities of U.S.A having reference key as State_Id.
    Which tables do you have now and what's their structure?

    Comment

    • nil81
      New Member
      • Jun 2007
      • 12

      #3
      i have two tables, these are:

      1. tbl_state
      2. tbl_city

      i have inserted values of USA States in "tbl_state" table but i don't know the related cities of these corresponding states.

      so please can you help me by giving insert queries for "tbl_city" table,

      so that i can have all cities of USA corresponding to their state.


      * Structure of both tables are as below:
      ----
      # tbl_state:

      id int(10) Unsigned Not Null Primary Key Autoincrement,
      code varchar(255) Null, //state code in two letters in caps for eg. AL, AK
      state varchar(255) Null // Full name of State for e.g, Alabama, Alaska

      ----
      # tbl_city

      id int(10) Unsigned Not Null Primary Key Autoincremen,
      state_id int(10) Unsigned Not Null Reference Key(tbl_state.i d),
      city varchar(255) Null

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by nil81
        i have two tables, these are:

        1. tbl_state
        2. tbl_city

        i have inserted values of USA States in "tbl_state" table but i don't know the related cities of these corresponding states.

        so please can you help me by giving insert queries for "tbl_city" table,

        so that i can have all cities of USA corresponding to their state.


        * Structure of both tables are as below:
        ----
        # tbl_state:

        id int(10) Unsigned Not Null Primary Key Autoincrement,
        code varchar(255) Null, //state code in two letters in caps for eg. AL, AK
        state varchar(255) Null // Full name of State for e.g, Alabama, Alaska

        ----
        # tbl_city

        id int(10) Unsigned Not Null Primary Key Autoincremen,
        state_id int(10) Unsigned Not Null Reference Key(tbl_state.i d),
        city varchar(255) Null
        Put all the cities in a file and load the data using a load file command. There are probably too many cities for you to insert them all using insert statements.

        Comment

        Working...