Looking For An Example Of How To Populate A Form From Subqueries.

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 1230 Views - Last Post: 09 August 2016 - 01:30 PM Rate Topic: -----

#1 pemby   User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 62
  • Joined: 27-June 15

Looking For An Example Of How To Populate A Form From Subqueries.

Posted 07 August 2016 - 03:36 PM

Say I have the following DB Tables.


Table 1. STATE
Table 2. CITY

Suppose State -> City is One To Many
for example


How could I use php/html/javascript ect.. ? to (in this order - if it makes sense)
1. Display list of states in a dropdown (from database);
2. Once state is selected via POST/GET (assuming post is ok here)
3. Return with current form and a second dropdown list with cites (from database) that relate to selected state.


Please let me know if you need more info or if something is not clear.

This post has been edited by pemby: 07 August 2016 - 03:37 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Looking For An Example Of How To Populate A Form From Subqueries.

#2 astonecipher   User is offline

  • Enterprise Software Architect
  • member icon

Reputation: 3150
  • View blog
  • Posts: 11,954
  • Joined: 03-December 12

Re: Looking For An Example Of How To Populate A Form From Subqueries.

Posted 07 August 2016 - 03:38 PM

What have you tried?
Was This Post Helpful? 0
  • +
  • -

#3 benanamen   User is offline

  • D.I.C Regular

Reputation: 38
  • View blog
  • Posts: 250
  • Joined: 28-March 15

Re: Looking For An Example Of How To Populate A Form From Subqueries.

Posted 07 August 2016 - 03:45 PM

What you are refering to is a "Dynamic Chained Select". Google is your friend on this. Also Ajax Dynamic Chained Select or Jquery Dynamic Chained Select.

This post has been edited by benanamen: 07 August 2016 - 03:45 PM

Was This Post Helpful? 0
  • +
  • -

#4 pemby   User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 62
  • Joined: 27-June 15

Re: Looking For An Example Of How To Populate A Form From Subqueries.

Posted 07 August 2016 - 03:50 PM

View Postastonecipher, on 07 August 2016 - 03:38 PM, said:

What have you tried?


Unfortunately I do not have any code to show you because this is a problem that I am revisiting from almost a year ago. At that time I tried everything I could google that seemed to be relate to this question. The problem I seemed to run into is most tutorials I found about coding city/state into a form, tended to use local variables (not database tables) to show how to do such a thing. Then when I could find something that related to doing subqueries via a form, they were too complicated for me to follow. (at that time)

Currently I am finishing up a SQL / DB class and I have a better understanding of what needs to happen on the DB side for a subquery. I am just looking for the simplest example, that I can think of, that shows how to use php to perform DB subqueries and return to a form (js scripting ok) that a user can interact with.

If you or anyone can ether show me a trivial example, or point me to a link is all I am asking. Hope that is not too much?

View Postbenanamen, on 07 August 2016 - 03:45 PM, said:

What you are refering to is a "Dynamic Chained Select". Google is your friend on this. Also Ajax Dynamic Chained Select or Jquery Dynamic Chained Select.


Thanks for the info! Do you happen to know of any examples that I can follow? It seems there is too much information when I google search, and I want to narrow down what I am following. Very specifically. See you could see an example and say. That is what I am looking for. But I could be looking at an example and not know it. Hope that makes sense.

Cheers!

This post has been edited by pemby: 07 August 2016 - 03:51 PM

Was This Post Helpful? 0
  • +
  • -

#5 astonecipher   User is offline

  • Enterprise Software Architect
  • member icon

Reputation: 3150
  • View blog
  • Posts: 11,954
  • Joined: 03-December 12

Re: Looking For An Example Of How To Populate A Form From Subqueries.

Posted 07 August 2016 - 03:54 PM

Look at the problem on a more granular problem.

How do you populate a select element with data from a table row?
Was This Post Helpful? 0
  • +
  • -

#6 pemby   User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 62
  • Joined: 27-June 15

Re: Looking For An Example Of How To Populate A Form From Subqueries.

Posted 07 August 2016 - 06:34 PM

View Postastonecipher, on 07 August 2016 - 03:54 PM, said:

Look at the problem on a more granular problem.

How do you populate a select element with data from a table row?


   SELECT Element,
   FROM   DATA;



Is that what you mean?
Was This Post Helpful? 0
  • +
  • -

#7 astonecipher   User is offline

  • Enterprise Software Architect
  • member icon

Reputation: 3150
  • View blog
  • Posts: 11,954
  • Joined: 03-December 12

Re: Looking For An Example Of How To Populate A Form From Subqueries.

Posted 07 August 2016 - 06:40 PM

I mean.

Quote

Here is a spec:

I want users to be able to select a state, provided thru a table in a database, from a drop-down on an html form.


Can you meet that minimum spec in code currently?
Was This Post Helpful? 0
  • +
  • -

#8 pemby   User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 62
  • Joined: 27-June 15

Re: Looking For An Example Of How To Populate A Form From Subqueries.

Posted 07 August 2016 - 06:51 PM

I already mentioned I do not have any code currently. Sorry if I was not clearer. Did you miss that? I am looking for a simple example. Even just a link, that encapsulates what I am trying to do.


Thanks!

This post has been edited by andrewsw: 09 August 2016 - 01:37 PM
Reason for edit:: Removed previous quote, just press REPLY

Was This Post Helpful? 0
  • +
  • -

#9 astonecipher   User is offline

  • Enterprise Software Architect
  • member icon

Reputation: 3150
  • View blog
  • Posts: 11,954
  • Joined: 03-December 12

Re: Looking For An Example Of How To Populate A Form From Subqueries.

Posted 07 August 2016 - 07:14 PM

Dynamically creating forms is a basic level of web development. Do you know how to create a form in HTML, at least? Or how to output HTML using PHP?

I found one tutorial on here, but it is a bit more advanced then where I think your current level of understanding lays.

Dynamic Dropdown Menus
Was This Post Helpful? 0
  • +
  • -

#10 pemby   User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 62
  • Joined: 27-June 15

Re: Looking For An Example Of How To Populate A Form From Subqueries.

Posted 07 August 2016 - 07:28 PM

View Postastonecipher, on 07 August 2016 - 07:14 PM, said:

Dynamically creating forms is a basic level of web development. Do you know how to create a form in HTML, at least? Or how to output HTML using PHP?

I found one tutorial on here, but it is a bit more advanced then where I think your current level of understanding lays.

Dynamic Dropdown Menus


Thank you for you input. That link points to an example where all the data is stored in local variables on that php page. That makes sense to me. I am looking for an example that explicitly shows how to implement such a drop down menu using DB data strictly.

The real problem with that example is that I would have to locally store ALL the values from the database before I logically parse them. That will not scale well with large amounts of data. For simplicity using state and city as an example. Let's assume I had 1000 "States", and each state had 1000 "City's". I do not want to store 1000000 elements before I parse them. I want to ask for 1000 elements, then select one element and receive 1000 more. In other words perform a basic subquery, using php.

Does that make sense?

This post has been edited by pemby: 07 August 2016 - 07:29 PM

Was This Post Helpful? 0
  • +
  • -

#11 astonecipher   User is offline

  • Enterprise Software Architect
  • member icon

Reputation: 3150
  • View blog
  • Posts: 11,954
  • Joined: 03-December 12

Re: Looking For An Example Of How To Populate A Form From Subqueries.

Posted 07 August 2016 - 07:32 PM

Working on a quick and dirty tutorial now that will explain the first basic. As far as the form portion goes. Though, there are better ways to deal with what you want to do in the long run...
Was This Post Helpful? 0
  • +
  • -

#12 astonecipher   User is offline

  • Enterprise Software Architect
  • member icon

Reputation: 3150
  • View blog
  • Posts: 11,954
  • Joined: 03-December 12

Re: Looking For An Example Of How To Populate A Form From Subqueries.

Posted 07 August 2016 - 07:40 PM

Quick tutorial. This is quick and dirty and does NOT utilize code separation, but demonstrates populating a select element with data from a table:
// Create your table and insert some data.
create table months
(
	mID int not null primary key,
    mName varchar(10) not null
) engine=InnoDB;

insert into months (mID, mName) VALUES
(1, 'January'),
(2, 'February'),
(3, 'March'),
(4, 'April'),
(5, 'May'),
(6, 'June'),
(7, 'July'),
(8, 'August'),
(9, 'September'),
(10, 'October'),
(11, 'November'),
(12, 'December');


Now the page code.
<?php
try {
    // connection to the database using PDO
    $pdo = new PDO('mysql:host=localhost; dbname=test', 'root');

    // Set the error levels. These will change for a production environment
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 
    

    $sql = 'SELECT mID, mName FROM months';
    $stmt = $pdo->prepare($sql);

    // Execute the SQL statement
    $stmt->execute();
    

    // fetch all of the results to iterate thru later
    $row = $stmt->fetchAll(PDO::FETCH_ASSOC);

} catch (PDOException $e) {
    echo $e->getMessage();
}

// this is to print the result from the form. In a real application, you would use that value.
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    echo "<p>You selected the numeric month: " . htmlentities($_POST['month']) . "</p>";
}

?>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Test</title>
<script
	src='//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js'></script>

<link rel="stylesheet" type="text/css"
	href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">

<script
	src="https://cdn.datatables.net/1.10.10/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" type="text/css"
	href="https://cdn.datatables.net/1.10.10/css/jquery.dataTables.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1">


</head>
<body>
	<div class="container">

		<form method="post">
			<div class="row">
				<select name="month">
	       <?php
        // iterate thru the results gathered at the top of the page.
        foreach ($row as $month) {
            echo "<option value='{$month['mID']}'>{$month['mName']}</option>"; // output them to a select element named 'mont'
        }
        ?>
	       </select>
			</div>
			<div class="row">
				<input type="submit" value="Send" class="btn btn-success">
			</div>
		</form>

	</div>

	<script
		src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.min.js'></script>
	<script
		src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js'></script>
</body>
</html>



Was This Post Helpful? 0
  • +
  • -

#13 astonecipher   User is offline

  • Enterprise Software Architect
  • member icon

Reputation: 3150
  • View blog
  • Posts: 11,954
  • Joined: 03-December 12

Re: Looking For An Example Of How To Populate A Form From Subqueries.

Posted 07 August 2016 - 08:04 PM

For follow up, you are not doing a subquery. A subquery is a query within another query. What you want to do is two distinct queries, the second is just filtered in the where clause by the previous selected value
Was This Post Helpful? 0
  • +
  • -

#14 andrewsw   User is offline

  • palpable absurdity
  • member icon

Reputation: 6905
  • View blog
  • Posts: 28,565
  • Joined: 12-December 12

Re: Looking For An Example Of How To Populate A Form From Subqueries.

Posted 07 August 2016 - 11:38 PM

Quote

3. Return with current form and a second dropdown list with cites (from database) that relate to selected state.

If you wanted this to happen within the same page, without reloading it, which is a typical requirement, then you would use Ajax. The change event of the first select would cause an Ajax request which, if successful, returns a list of corresponding cities, which is then used to populate the second select.

Ajax | MDN
Was This Post Helpful? 0
  • +
  • -

#15 pemby   User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 62
  • Joined: 27-June 15

Re: Looking For An Example Of How To Populate A Form From Subqueries.

Posted 09 August 2016 - 12:19 PM

View Postastonecipher, on 07 August 2016 - 08:04 PM, said:

For follow up, you are not doing a subquery. A subquery is a query within another query. What you want to do is two distinct queries, the second is just filtered in the where clause by the previous selected value


Yes thank you for understanding what I meant! And thank you for you help thus far. Here is where I am at with some code.

Here is the database tables.


ALTER TABLE IF EXISTS public.city DROP CONSTRAINT city_fk_stateid_fkey;
DROP TABLE IF EXISTS city;
DROP TABLE IF EXISTS state;

CREATE TABLE public.state
(
  StateID SERIAL PRIMARY KEY  NOT NULL,
  Abrev   VARCHAR(20)         NOT NULL,
  Name    VARCHAR(30)         NOT NULL
);
CREATE UNIQUE INDEX "STATE_ID_uindex"
  ON public.state (StateID);
CREATE UNIQUE INDEX "STATE_Abrev_uindex"
  ON public.state (Abrev);
CREATE UNIQUE INDEX "STATE_Name_uindex"
  ON public.state (Name);

INSERT INTO state (Abrev, Name) VALUES ('AL','Alabama');
INSERT INTO state (Abrev, Name) VALUES ('AK','Alaska');
INSERT INTO state (Abrev, Name) VALUES ('AZ','Arizona');
INSERT INTO state (Abrev, Name) VALUES ('AR','Arkansas');
INSERT INTO state (Abrev, Name) VALUES ('CA','California');
INSERT INTO state (Abrev, Name) VALUES ('CO','Colorado');
INSERT INTO state (Abrev, Name) VALUES ('CT','Connecticut');
INSERT INTO state (Abrev, Name) VALUES ('DE','Delaware');
INSERT INTO state (Abrev, Name) VALUES ('FL','Florida');
INSERT INTO state (Abrev, Name) VALUES ('GA','Georgia');
INSERT INTO state (Abrev, Name) VALUES ('HI','Hawaii');
INSERT INTO state (Abrev, Name) VALUES ('ID','Idaho');
INSERT INTO state (Abrev, Name) VALUES ('IL','Illinois');
INSERT INTO state (Abrev, Name) VALUES ('IN','Indiana');
INSERT INTO state (Abrev, Name) VALUES ('IA','Iowa');
INSERT INTO state (Abrev, Name) VALUES ('KS','Kansas');
INSERT INTO state (Abrev, Name) VALUES ('KY','Kentucky');
INSERT INTO state (Abrev, Name) VALUES ('LA','Louisiana');
INSERT INTO state (Abrev, Name) VALUES ('ME','Maine');
INSERT INTO state (Abrev, Name) VALUES ('MD','Maryland');
INSERT INTO state (Abrev, Name) VALUES ('MA','Massachusetts');
INSERT INTO state (Abrev, Name) VALUES ('MI','Michigan');
INSERT INTO state (Abrev, Name) VALUES ('MN','Minnesota');
INSERT INTO state (Abrev, Name) VALUES ('MS','Mississippi');
INSERT INTO state (Abrev, Name) VALUES ('MO','Missouri');
INSERT INTO state (Abrev, Name) VALUES ('MT','Montana');
INSERT INTO state (Abrev, Name) VALUES ('NE','Nebraska');
INSERT INTO state (Abrev, Name) VALUES ('NV','Nevada');
INSERT INTO state (Abrev, Name) VALUES ('NH','New Hampshire');
INSERT INTO state (Abrev, Name) VALUES ('NJ','New Jersey');
INSERT INTO state (Abrev, Name) VALUES ('NM','New Mexico');
INSERT INTO state (Abrev, Name) VALUES ('NY','New York');
INSERT INTO state (Abrev, Name) VALUES ('NC','North Carolina');
INSERT INTO state (Abrev, Name) VALUES ('ND','North Dakota');
INSERT INTO state (Abrev, Name) VALUES ('OH','Ohio');
INSERT INTO state (Abrev, Name) VALUES ('OK','Oklahoma');
INSERT INTO state (Abrev, Name) VALUES ('OR','Oregon');
INSERT INTO state (Abrev, Name) VALUES ('PA','Pennsylvania');
INSERT INTO state (Abrev, Name) VALUES ('RI','Rhode Island');
INSERT INTO state (Abrev, Name) VALUES ('SC','South Carolina');
INSERT INTO state (Abrev, Name) VALUES ('SD','South Dakota');
INSERT INTO state (Abrev, Name) VALUES ('TN','Tennessee');
INSERT INTO state (Abrev, Name) VALUES ('TX','Texas');
INSERT INTO state (Abrev, Name) VALUES ('UT','Utah');
INSERT INTO state (Abrev, Name) VALUES ('VT','Vermont');
INSERT INTO state (Abrev, Name) VALUES ('VA','Virginia');
INSERT INTO state (Abrev, Name) VALUES ('WA','Washington');
INSERT INTO state (Abrev, Name) VALUES ('WV','West Virginia');
INSERT INTO state (Abrev, Name) VALUES ('WI','Wisconsin');
INSERT INTO state (Abrev, Name) VALUES ('WY','Wyoming');
INSERT INTO state (Abrev, Name) VALUES ('AS','American Samoa');
INSERT INTO state (Abrev, Name) VALUES ('DC','District of Columbia');
INSERT INTO state (Abrev, Name) VALUES ('FM','Federated States of Micronesia');
INSERT INTO state (Abrev, Name) VALUES ('GU','Guam');
INSERT INTO state (Abrev, Name) VALUES ('MH','Marshall Islands');
INSERT INTO state (Abrev, Name) VALUES ('MP','Northern Mariana Islands');
INSERT INTO state (Abrev, Name) VALUES ('PW','Palau');
INSERT INTO state (Abrev, Name) VALUES ('PR','Puerto Ric');
INSERT INTO state (Abrev, Name) VALUES ('VI','Virgin Islands');


CREATE TABLE public.city
(
    CityID SERIAL PRIMARY KEY NOT NULL,
    Abrev VARCHAR(3) NOT NULL,
    Name VARCHAR(28) NOT NULL,
    fk_stateID INTEGER REFERENCES state (stateid)
);
CREATE UNIQUE INDEX "city_CityID_uindex" ON public.city (CityID);
CREATE UNIQUE INDEX "city_Abrev_uindex" ON public.city (Abrev);


INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ADK', 'Adak Island',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AUK', 'Alakanuk',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AFM', 'Ambler',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AKP', 'Anaktuvuk Pass',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ANC', 'Anchorage',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MRI', 'Anchorage',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LHD', 'Anchorage',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AGN', 'Angoon',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ANI', 'Aniak',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ATK', 'Atqasuk',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BRW', 'Barrow',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BET', 'Bethel',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BVK', 'Buckland',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CFK', 'Chefornak',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('VAK', 'Chevak',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CDB', 'Cold Bay',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CDV', 'Cordova',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CGA', 'Craig',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SCC', 'Deadhorse',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BIG', 'Delta Junction Ft Greely',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DLG', 'Dillingham',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('EEK', 'Eek',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ELI', 'Elim',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ENM', 'Emmonak',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('KEB', 'English Bay',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FAI', 'Fairbanks',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FYU', 'Fort Yukon',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GBH', 'Galbraith Lake',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GAL', 'Galena',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GAM', 'Gambell',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('N93', 'Golovin',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GKN', 'Gulkana',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GST', 'Gustavus',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HNS', 'Haines',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HYL', 'Hollis',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HOM', 'Homer',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HNH', 'Hoonah',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HPB', 'Hooper Bay',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HLA', 'Huslia',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HSL', 'Huslia',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ILI', 'Iliamna',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('JNU', 'Juneau',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('KAE', 'Kake',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BTI', 'Kaktovik',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('KLG', 'Kalskag',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('KAL', 'Kaltag',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('Z09', 'Kasigluk',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ENA', 'Kenai',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('KTN', 'Ketchikan',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('IAN', 'Kiana',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('KVC', 'King Cove',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AKN', 'King Salmon',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('IIK', 'Kipnuk',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('KVL', 'Kivalina',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AKW', 'Klawock',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ADQ', 'Kodiak',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('KDK', 'Kodiak',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('T44', 'Kodiak',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DUY', 'Kongiganak',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('2A9', 'Kotlik',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OTZ', 'Kotzebue',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('KKA', 'Koyuk',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('KWT', 'Kwethluk',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GGV', 'Kwigillingok',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('A85', 'Kwigillingok',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('2A3', 'Larsen Bay',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MBA', 'Manokotak',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MDM', 'Marshall',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('3A5', 'Marshall',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MLL', 'Marshall',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MCG', 'McGrath',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MTM', 'Metlakatla',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MOU', 'Mountain Village',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('WNA', 'Napakiak',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('EWU', 'Newtok',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('WTK', 'Noatak',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OME', 'Nome',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('D76', 'Noorvik',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ORV', 'Noorvik',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AQT', 'Nuiqsut',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('NUL', 'Nulato',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('16A', 'Nunapitchuk',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('6R7', 'Old Harbor',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PSG', 'Petersburg',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('0AK', 'Pilot Station',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PHO', 'Point Hope',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PGM', 'Port Graham',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PTH', 'Port Heiden',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ORI', 'Port Lions',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PPC', 'Prospect Creek',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AQH', 'Quinhagak',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('RSH', 'Russian Mission',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SDP', 'Sand Point',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SVA', 'Savoonga',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SCM', 'Scammon Bay',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('WLK', 'Selawik',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SOV', 'Seldovia',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SHH', 'Shishmaref',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SHG', 'Shungnak',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SIT', 'Sitka',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SGY', 'Skagway',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('KSM', 'St Mary''s',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SNP', 'St Paul Island',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('WBB', 'Stebbins',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TAL', 'Tanana',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('KTB', 'Thorne Bay',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TOG', 'Togiak Village',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OOK', 'Toksook Bay',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TLT', 'Tuluksak',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('A61', 'Tuntutuliak',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('UNK', 'Unalakleet',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DUT', 'Unalaska',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('VDZ', 'Valdez',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AWI', 'Wainwright',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('WRG', 'Wrangell',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('YAK', 'Yakutat',(SELECT StateID FROM state WHERE Abrev = 'AK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ANB', 'Anniston',(SELECT StateID FROM state WHERE Abrev = 'AL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BHM', 'Birmingham',(SELECT StateID FROM state WHERE Abrev = 'AL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DHN', 'Dothan',(SELECT StateID FROM state WHERE Abrev = 'AL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HSV', 'Huntsville',(SELECT StateID FROM state WHERE Abrev = 'AL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MOB', 'Mobile',(SELECT StateID FROM state WHERE Abrev = 'AL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MGM', 'Montgomery',(SELECT StateID FROM state WHERE Abrev = 'AL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MSL', 'Muscle Shoals',(SELECT StateID FROM state WHERE Abrev = 'AL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ASN', 'Talladega',(SELECT StateID FROM state WHERE Abrev = 'AL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TCL', 'Tuscaloosa',(SELECT StateID FROM state WHERE Abrev = 'AL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FYV', 'Fayetteville',(SELECT StateID FROM state WHERE Abrev = 'AR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('XNA', 'Fayetteville / Springdale',(SELECT StateID FROM state WHERE Abrev = 'AR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FSM', 'Fort Smith',(SELECT StateID FROM state WHERE Abrev = 'AR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HRO', 'Harrison',(SELECT StateID FROM state WHERE Abrev = 'AR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HOT', 'Hot Springs',(SELECT StateID FROM state WHERE Abrev = 'AR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('JBR', 'Jonesboro',(SELECT StateID FROM state WHERE Abrev = 'AR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LIT', 'Little Rock',(SELECT StateID FROM state WHERE Abrev = 'AR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BPK', 'Mountain Home',(SELECT StateID FROM state WHERE Abrev = 'AR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TXK', 'Texarkana',(SELECT StateID FROM state WHERE Abrev = 'AR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FAQ', 'Fitiuta',(SELECT StateID FROM state WHERE Abrev = 'AS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('Z08', 'Ofu Village',(SELECT StateID FROM state WHERE Abrev = 'AS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PPG', 'Pago Pago',(SELECT StateID FROM state WHERE Abrev = 'AS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('IFP', 'Bullhead City',(SELECT StateID FROM state WHERE Abrev = 'AZ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FLG', 'Flagstaff',(SELECT StateID FROM state WHERE Abrev = 'AZ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FHU', 'Fort Huachuca / Sierra Vista',(SELECT StateID FROM state WHERE Abrev = 'AZ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GYR', 'Goodyear',(SELECT StateID FROM state WHERE Abrev = 'AZ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GCN', 'Grand Canyon',(SELECT StateID FROM state WHERE Abrev = 'AZ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('IGM', 'Kingman',(SELECT StateID FROM state WHERE Abrev = 'AZ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HII', 'Lake Havasu City',(SELECT StateID FROM state WHERE Abrev = 'AZ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MZJ', 'Marana',(SELECT StateID FROM state WHERE Abrev = 'AZ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('IWA', 'Mesa',(SELECT StateID FROM state WHERE Abrev = 'AZ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PGA', 'Page',(SELECT StateID FROM state WHERE Abrev = 'AZ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('1G4', 'Peach Springs',(SELECT StateID FROM state WHERE Abrev = 'AZ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DVT', 'Phoenix',(SELECT StateID FROM state WHERE Abrev = 'AZ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PHX', 'Phoenix',(SELECT StateID FROM state WHERE Abrev = 'AZ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PRC', 'Prescott',(SELECT StateID FROM state WHERE Abrev = 'AZ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SOW', 'Show Low',(SELECT StateID FROM state WHERE Abrev = 'AZ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TUS', 'Tucson',(SELECT StateID FROM state WHERE Abrev = 'AZ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('YUM', 'Yuma',(SELECT StateID FROM state WHERE Abrev = 'AZ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ACV', 'Arcata/Eureka',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BFL', 'Bakersfield',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BUR', 'Burbank',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CRQ', 'Carlsbad',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CIC', 'Chico',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CCR', 'Concord',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CEC', 'Crescent City',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FAT', 'Fresno',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('IPL', 'Imperial',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('IYK', 'Inyokern',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LGB', 'Long Beach',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LAX', 'Los Angeles',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MMH', 'Mammoth Lakes',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MCE', 'Merced',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MOD', 'Modesto',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MRY', 'Monterey',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OAK', 'Oakland',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ONT', 'Ontario',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SNA', 'Orange County',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OXR', 'Oxnard',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PSP', 'Palm Springs',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PMD', 'Palmdale',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PRB', 'Paso Robles',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('RDD', 'Redding',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SMF', 'Sacramento',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MCC', 'Sacramento',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SBD', 'San Bernardino',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SAN', 'San Diego',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SFO', 'San Francisco',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SJC', 'San Jose',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SBP', 'San Luis Obispo',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SBA', 'Santa Barbara',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SMX', 'Santa Maria',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('STS', 'Santa Rosa',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TVL', 'South Lake Tahoe',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SCK', 'Stockton',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('VCV', 'Victorville',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('VIS', 'Visalia',(SELECT StateID FROM state WHERE Abrev = 'CA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ALS', 'Alamosa',(SELECT StateID FROM state WHERE Abrev = 'CO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ASE', 'Aspen',(SELECT StateID FROM state WHERE Abrev = 'CO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('COS', 'Colorado Springs',(SELECT StateID FROM state WHERE Abrev = 'CO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CEZ', 'Cortez',(SELECT StateID FROM state WHERE Abrev = 'CO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DEN', 'Denver',(SELECT StateID FROM state WHERE Abrev = 'CO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DRO', 'Durango',(SELECT StateID FROM state WHERE Abrev = 'CO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('EGE', 'Eagle',(SELECT StateID FROM state WHERE Abrev = 'CO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FNL', 'Fort Collins / Loveland',(SELECT StateID FROM state WHERE Abrev = 'CO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GJT', 'Grand Junction',(SELECT StateID FROM state WHERE Abrev = 'CO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GUC', 'Gunnison',(SELECT StateID FROM state WHERE Abrev = 'CO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HDN', 'Hayden',(SELECT StateID FROM state WHERE Abrev = 'CO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LAA', 'Lamar',(SELECT StateID FROM state WHERE Abrev = 'CO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MTJ', 'Montrose',(SELECT StateID FROM state WHERE Abrev = 'CO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PUB', 'Pueblo',(SELECT StateID FROM state WHERE Abrev = 'CO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TEX', 'Telluride',(SELECT StateID FROM state WHERE Abrev = 'CO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GRO', 'Rota Island',(SELECT StateID FROM state WHERE Abrev = 'CQ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GSN', 'Saipan Island',(SELECT StateID FROM state WHERE Abrev = 'CQ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TNI', 'Tinian Island',(SELECT StateID FROM state WHERE Abrev = 'CQ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BDR', 'Bridgeport',(SELECT StateID FROM state WHERE Abrev = 'CT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DXR', 'Danbury',(SELECT StateID FROM state WHERE Abrev = 'CT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GON', 'Groton (New London)',(SELECT StateID FROM state WHERE Abrev = 'CT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HFD', 'Hartford',(SELECT StateID FROM state WHERE Abrev = 'CT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HVN', 'New Haven',(SELECT StateID FROM state WHERE Abrev = 'CT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OXC', 'Oxford',(SELECT StateID FROM state WHERE Abrev = 'CT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BDL', 'Windsor Locks',(SELECT StateID FROM state WHERE Abrev = 'CT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('IAD', 'Washington',(SELECT StateID FROM state WHERE Abrev = 'DC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DCA', 'Washington',(SELECT StateID FROM state WHERE Abrev = 'DC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GED', 'Georgetown',(SELECT StateID FROM state WHERE Abrev = 'DE'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ILG', 'Wilmington',(SELECT StateID FROM state WHERE Abrev = 'DE'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DAB', 'Daytona Beach',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FLL', 'Fort Lauderdale',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('RSW', 'Fort Myers',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GNV', 'Gainesville',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('JAX', 'Jacksonville',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('VQQ', 'Jacksonville',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('EYW', 'Key West',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LAL', 'Lakeland',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MTH', 'Marathon',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MLB', 'Melbourne',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MIA', 'Miami',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('X44', 'Miami',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('APF', 'Naples',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OCF', 'Ocala',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MCO', 'Orlando',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PFN', 'Panama City',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PNS', 'Pensacola',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PGD', 'Punta Gorda',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PIE', 'Saint Petersburg',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SFB', 'Sanford',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SRQ', 'Sarasota',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SGJ', 'St Augustine',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TLH', 'Tallahassee',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TPA', 'Tampa',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TIX', 'Titusville',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('VPS', 'Valparaiso',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('VRB', 'Vero Beach',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PBI', 'West Palm Beach',(SELECT StateID FROM state WHERE Abrev = 'FL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ABY', 'Albany',(SELECT StateID FROM state WHERE Abrev = 'GA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AHN', 'Athens',(SELECT StateID FROM state WHERE Abrev = 'GA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ATL', 'Atlanta',(SELECT StateID FROM state WHERE Abrev = 'GA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AGS', 'Augusta',(SELECT StateID FROM state WHERE Abrev = 'GA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BQK', 'Brunswick',(SELECT StateID FROM state WHERE Abrev = 'GA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CSG', 'Columbus',(SELECT StateID FROM state WHERE Abrev = 'GA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MCN', 'Macon',(SELECT StateID FROM state WHERE Abrev = 'GA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('RMG', 'Rome',(SELECT StateID FROM state WHERE Abrev = 'GA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SAV', 'Savannah',(SELECT StateID FROM state WHERE Abrev = 'GA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('VLD', 'Valdosta',(SELECT StateID FROM state WHERE Abrev = 'GA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GUM', 'Agana',(SELECT StateID FROM state WHERE Abrev = 'GU'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HNM', 'Hana',(SELECT StateID FROM state WHERE Abrev = 'HI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ITO', 'Hilo',(SELECT StateID FROM state WHERE Abrev = 'HI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HNL', 'Honolulu',(SELECT StateID FROM state WHERE Abrev = 'HI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OGG', 'Kahului',(SELECT StateID FROM state WHERE Abrev = 'HI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MUE', 'Kamuela',(SELECT StateID FROM state WHERE Abrev = 'HI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MKK', 'Kaunakakai',(SELECT StateID FROM state WHERE Abrev = 'HI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('KOA', 'Keahole',(SELECT StateID FROM state WHERE Abrev = 'HI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LNY', 'Lanai City',(SELECT StateID FROM state WHERE Abrev = 'HI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LIH', 'Lihue',(SELECT StateID FROM state WHERE Abrev = 'HI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BRL', 'Burlington',(SELECT StateID FROM state WHERE Abrev = 'IA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CID', 'Cedar Rapids',(SELECT StateID FROM state WHERE Abrev = 'IA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CWI', 'Clinton',(SELECT StateID FROM state WHERE Abrev = 'IA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DSM', 'Des Moines',(SELECT StateID FROM state WHERE Abrev = 'IA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DBQ', 'Dubuque',(SELECT StateID FROM state WHERE Abrev = 'IA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FOD', 'Fort Dodge',(SELECT StateID FROM state WHERE Abrev = 'IA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MCW', 'Mason City',(SELECT StateID FROM state WHERE Abrev = 'IA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OTM', 'Ottumwa',(SELECT StateID FROM state WHERE Abrev = 'IA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SUX', 'Sioux City',(SELECT StateID FROM state WHERE Abrev = 'IA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ALO', 'Waterloo',(SELECT StateID FROM state WHERE Abrev = 'IA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BOI', 'Boise',(SELECT StateID FROM state WHERE Abrev = 'ID'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('COE', 'Coeur D''alene',(SELECT StateID FROM state WHERE Abrev = 'ID'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SUN', 'Hailey',(SELECT StateID FROM state WHERE Abrev = 'ID'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('IDA', 'Idaho Falls',(SELECT StateID FROM state WHERE Abrev = 'ID'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LWS', 'Lewiston',(SELECT StateID FROM state WHERE Abrev = 'ID'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PIH', 'Pocatello',(SELECT StateID FROM state WHERE Abrev = 'ID'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TWF', 'Twin Falls',(SELECT StateID FROM state WHERE Abrev = 'ID'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ALN', 'Alton/St Louis',(SELECT StateID FROM state WHERE Abrev = 'IL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BLV', 'Belleville',(SELECT StateID FROM state WHERE Abrev = 'IL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BMI', 'Bloomington',(SELECT StateID FROM state WHERE Abrev = 'IL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MDH', 'Carbondale / Murphysboro',(SELECT StateID FROM state WHERE Abrev = 'IL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CMI', 'Champaign',(SELECT StateID FROM state WHERE Abrev = 'IL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MDW', 'Chicago',(SELECT StateID FROM state WHERE Abrev = 'IL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ORD', 'Chicago',(SELECT StateID FROM state WHERE Abrev = 'IL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CGX', 'Chicago',(SELECT StateID FROM state WHERE Abrev = 'IL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DNV', 'Danville',(SELECT StateID FROM state WHERE Abrev = 'IL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DEC', 'Decatur',(SELECT StateID FROM state WHERE Abrev = 'IL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MWA', 'Marion',(SELECT StateID FROM state WHERE Abrev = 'IL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MTO', 'Mattoon/Charleston',(SELECT StateID FROM state WHERE Abrev = 'IL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MLI', 'Moline',(SELECT StateID FROM state WHERE Abrev = 'IL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MVN', 'Mount Vernon',(SELECT StateID FROM state WHERE Abrev = 'IL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PIA', 'Peoria',(SELECT StateID FROM state WHERE Abrev = 'IL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('UIN', 'Quincy',(SELECT StateID FROM state WHERE Abrev = 'IL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('RFD', 'Rockford',(SELECT StateID FROM state WHERE Abrev = 'IL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SPI', 'Springfield',(SELECT StateID FROM state WHERE Abrev = 'IL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SQI', 'Sterling/Rockfalls',(SELECT StateID FROM state WHERE Abrev = 'IL'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AID', 'Anderson',(SELECT StateID FROM state WHERE Abrev = 'IN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BMG', 'Bloomington',(SELECT StateID FROM state WHERE Abrev = 'IN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BAK', 'Columbus',(SELECT StateID FROM state WHERE Abrev = 'IN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('EKM', 'Elkhart',(SELECT StateID FROM state WHERE Abrev = 'IN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('EVV', 'Evansville',(SELECT StateID FROM state WHERE Abrev = 'IN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FWA', 'Fort Wayne',(SELECT StateID FROM state WHERE Abrev = 'IN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GYY', 'Gary',(SELECT StateID FROM state WHERE Abrev = 'IN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('IND', 'Indianapolis',(SELECT StateID FROM state WHERE Abrev = 'IN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MQJ', 'Indianapolis',(SELECT StateID FROM state WHERE Abrev = 'IN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LAF', 'Lafayette',(SELECT StateID FROM state WHERE Abrev = 'IN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MIE', 'Muncie',(SELECT StateID FROM state WHERE Abrev = 'IN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SBN', 'South Bend',(SELECT StateID FROM state WHERE Abrev = 'IN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HUF', 'Terre Haute',(SELECT StateID FROM state WHERE Abrev = 'IN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('VPZ', 'Valparaiso',(SELECT StateID FROM state WHERE Abrev = 'IN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DDC', 'Dodge City',(SELECT StateID FROM state WHERE Abrev = 'KS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GCK', 'Garden City',(SELECT StateID FROM state WHERE Abrev = 'KS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GLD', 'Goodland',(SELECT StateID FROM state WHERE Abrev = 'KS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GBD', 'Great Bend',(SELECT StateID FROM state WHERE Abrev = 'KS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HYS', 'Hays',(SELECT StateID FROM state WHERE Abrev = 'KS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HUT', 'Hutchinson',(SELECT StateID FROM state WHERE Abrev = 'KS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LBL', 'Liberal',(SELECT StateID FROM state WHERE Abrev = 'KS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MHK', 'Manhattan',(SELECT StateID FROM state WHERE Abrev = 'KS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('IXD', 'Olathe',(SELECT StateID FROM state WHERE Abrev = 'KS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SLN', 'Salina',(SELECT StateID FROM state WHERE Abrev = 'KS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FOE', 'Topeka',(SELECT StateID FROM state WHERE Abrev = 'KS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ICT', 'Wichita',(SELECT StateID FROM state WHERE Abrev = 'KS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BWG', 'Bowling Green',(SELECT StateID FROM state WHERE Abrev = 'KY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LEX', 'Lexington',(SELECT StateID FROM state WHERE Abrev = 'KY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SDF', 'Louisville',(SELECT StateID FROM state WHERE Abrev = 'KY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OWB', 'Owensboro',(SELECT StateID FROM state WHERE Abrev = 'KY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PAH', 'Paducah',(SELECT StateID FROM state WHERE Abrev = 'KY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AEX', 'Alexandria',(SELECT StateID FROM state WHERE Abrev = 'LA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ESF', 'Alexandria',(SELECT StateID FROM state WHERE Abrev = 'LA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BTR', 'Baton Rouge',(SELECT StateID FROM state WHERE Abrev = 'LA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LCH', 'Lake Charles',(SELECT StateID FROM state WHERE Abrev = 'LA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LFT', 'Lafayette',(SELECT StateID FROM state WHERE Abrev = 'LA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MLU', 'Monroe',(SELECT StateID FROM state WHERE Abrev = 'LA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MSY', 'New Orleans',(SELECT StateID FROM state WHERE Abrev = 'LA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('NEW', 'New Orleans',(SELECT StateID FROM state WHERE Abrev = 'LA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SHV', 'Shreveport',(SELECT StateID FROM state WHERE Abrev = 'LA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('VTR', 'Tallulah/Vicksburg',(SELECT StateID FROM state WHERE Abrev = 'LA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BED', 'Bedford',(SELECT StateID FROM state WHERE Abrev = 'MA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BOS', 'Boston',(SELECT StateID FROM state WHERE Abrev = 'MA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HYA', 'Hyannis',(SELECT StateID FROM state WHERE Abrev = 'MA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ACK', 'Nantucket',(SELECT StateID FROM state WHERE Abrev = 'MA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('EWB', 'New Bedford',(SELECT StateID FROM state WHERE Abrev = 'MA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PVC', 'Provincetown',(SELECT StateID FROM state WHERE Abrev = 'MA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CEF', 'Springfield/Chicopee',(SELECT StateID FROM state WHERE Abrev = 'MA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MVY', 'Vineyard Haven',(SELECT StateID FROM state WHERE Abrev = 'MA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BAF', 'Westfield/Springfield',(SELECT StateID FROM state WHERE Abrev = 'MA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ORH', 'Worcester',(SELECT StateID FROM state WHERE Abrev = 'MA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BWI', 'BWI Airport',(SELECT StateID FROM state WHERE Abrev = 'MD'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HGR', 'Hagerstown',(SELECT StateID FROM state WHERE Abrev = 'MD'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SBY', 'Salisbury',(SELECT StateID FROM state WHERE Abrev = 'MD'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AUG', 'Augusta',(SELECT StateID FROM state WHERE Abrev = 'ME'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BGR', 'Bangor',(SELECT StateID FROM state WHERE Abrev = 'ME'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BHB', 'Bar Harbor',(SELECT StateID FROM state WHERE Abrev = 'ME'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PWM', 'Portland',(SELECT StateID FROM state WHERE Abrev = 'ME'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PQI', 'Presque Isle',(SELECT StateID FROM state WHERE Abrev = 'ME'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('RKD', 'Rockland',(SELECT StateID FROM state WHERE Abrev = 'ME'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('APN', 'Alpena',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BTL', 'Battle Creek',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ACB', 'Bellaire',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BEH', 'Benton Harbor',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CVX', 'Charlevoix',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DTW', 'Detroit',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DET', 'Detroit',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ESC', 'Escanaba',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FNT', 'Flint',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GLR', 'Gaylord',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GRR', 'Grand Rapids',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CMX', 'Hancock',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('IMT', 'Iron Mountain / Kingsford',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('IWD', 'Ironwood',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('JXN', 'Jackson',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AZO', 'Kalamazoo',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LAN', 'Lansing',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MBL', 'Manistee',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SAW', 'Marquette',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MNM', 'Menominee',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MKG', 'Muskegon',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PLN', 'Pellston',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PTK', 'Pontiac',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MBS', 'Saginaw',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CIU', 'Sault Ste Marie',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TVC', 'Traverse City',(SELECT StateID FROM state WHERE Abrev = 'MI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AXN', 'Alexandria',(SELECT StateID FROM state WHERE Abrev = 'MN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BDE', 'Baudette',(SELECT StateID FROM state WHERE Abrev = 'MN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BJI', 'Bemidji',(SELECT StateID FROM state WHERE Abrev = 'MN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BRD', 'Brainerd',(SELECT StateID FROM state WHERE Abrev = 'MN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DLH', 'Duluth',(SELECT StateID FROM state WHERE Abrev = 'MN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ELO', 'Ely',(SELECT StateID FROM state WHERE Abrev = 'MN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FRM', 'Fairmont',(SELECT StateID FROM state WHERE Abrev = 'MN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GPZ', 'Grand Rapids',(SELECT StateID FROM state WHERE Abrev = 'MN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HIB', 'Hibbing',(SELECT StateID FROM state WHERE Abrev = 'MN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('INL', 'International Falls',(SELECT StateID FROM state WHERE Abrev = 'MN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MKT', 'Mankato',(SELECT StateID FROM state WHERE Abrev = 'MN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MSP', 'Minneapolis',(SELECT StateID FROM state WHERE Abrev = 'MN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('RST', 'Rochester',(SELECT StateID FROM state WHERE Abrev = 'MN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('STC', 'St Cloud',(SELECT StateID FROM state WHERE Abrev = 'MN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('STP', 'St Paul',(SELECT StateID FROM state WHERE Abrev = 'MN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TVF', 'Thief River Falls',(SELECT StateID FROM state WHERE Abrev = 'MN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ILL', 'Willmar',(SELECT StateID FROM state WHERE Abrev = 'MN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OTG', 'Worthington',(SELECT StateID FROM state WHERE Abrev = 'MN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CGI', 'Cape Girardeau',(SELECT StateID FROM state WHERE Abrev = 'MO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('COU', 'Columbia',(SELECT StateID FROM state WHERE Abrev = 'MO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TBN', 'Fort Leonard Wood',(SELECT StateID FROM state WHERE Abrev = 'MO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('JEF', 'Jefferson City',(SELECT StateID FROM state WHERE Abrev = 'MO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('JLN', 'Joplin',(SELECT StateID FROM state WHERE Abrev = 'MO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AIZ', 'Kaiser Lake Ozark',(SELECT StateID FROM state WHERE Abrev = 'MO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MCI', 'Kansas City',(SELECT StateID FROM state WHERE Abrev = 'MO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MKC', 'Kansas City',(SELECT StateID FROM state WHERE Abrev = 'MO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('IRK', 'Kirksville',(SELECT StateID FROM state WHERE Abrev = 'MO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PLK', 'Point Lookout',(SELECT StateID FROM state WHERE Abrev = 'MO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('STL', 'Saint Louis',(SELECT StateID FROM state WHERE Abrev = 'MO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SGF', 'Springfield',(SELECT StateID FROM state WHERE Abrev = 'MO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('STJ', 'St Joseph',(SELECT StateID FROM state WHERE Abrev = 'MO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SUS', 'St Louis',(SELECT StateID FROM state WHERE Abrev = 'MO'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MDY', 'Sand Island',(SELECT StateID FROM state WHERE Abrev = 'MQ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GTR', 'Columbus',(SELECT StateID FROM state WHERE Abrev = 'MS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GLH', 'Greenville',(SELECT StateID FROM state WHERE Abrev = 'MS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GPT', 'Gulfport',(SELECT StateID FROM state WHERE Abrev = 'MS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PIB', 'Hattiesburg / Laurel',(SELECT StateID FROM state WHERE Abrev = 'MS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('JAN', 'Jackson',(SELECT StateID FROM state WHERE Abrev = 'MS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HKS', 'Jackson',(SELECT StateID FROM state WHERE Abrev = 'MS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MEI', 'Meridian',(SELECT StateID FROM state WHERE Abrev = 'MS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('UOX', 'Oxford',(SELECT StateID FROM state WHERE Abrev = 'MS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PQL', 'Pascagoula',(SELECT StateID FROM state WHERE Abrev = 'MS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TUP', 'Tupelo',(SELECT StateID FROM state WHERE Abrev = 'MS'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BIL', 'Billings',(SELECT StateID FROM state WHERE Abrev = 'MT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BZN', 'Bozeman',(SELECT StateID FROM state WHERE Abrev = 'MT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BTM', 'Butte',(SELECT StateID FROM state WHERE Abrev = 'MT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GGW', 'Glasgow',(SELECT StateID FROM state WHERE Abrev = 'MT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GTF', 'Great Falls',(SELECT StateID FROM state WHERE Abrev = 'MT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HLN', 'Helena',(SELECT StateID FROM state WHERE Abrev = 'MT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GPI', 'Kalispell',(SELECT StateID FROM state WHERE Abrev = 'MT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MSO', 'Missoula',(SELECT StateID FROM state WHERE Abrev = 'MT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SDY', 'Sidney',(SELECT StateID FROM state WHERE Abrev = 'MT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('WYS', 'West Yellowstone',(SELECT StateID FROM state WHERE Abrev = 'MT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AVL', 'Asheville',(SELECT StateID FROM state WHERE Abrev = 'NC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CLT', 'Charlotte',(SELECT StateID FROM state WHERE Abrev = 'NC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FAY', 'Fayetteville',(SELECT StateID FROM state WHERE Abrev = 'NC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GSO', 'Greensboro',(SELECT StateID FROM state WHERE Abrev = 'NC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PGV', 'Greenville',(SELECT StateID FROM state WHERE Abrev = 'NC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HKY', 'Hickory',(SELECT StateID FROM state WHERE Abrev = 'NC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OAJ', 'Jacksonville',(SELECT StateID FROM state WHERE Abrev = 'NC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ISO', 'Kinston',(SELECT StateID FROM state WHERE Abrev = 'NC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MQI', 'Manteo',(SELECT StateID FROM state WHERE Abrev = 'NC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('EWN', 'New Bern',(SELECT StateID FROM state WHERE Abrev = 'NC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SOP', 'Pinehurst/Southern Pines',(SELECT StateID FROM state WHERE Abrev = 'NC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('RDU', 'Rdu Airport',(SELECT StateID FROM state WHERE Abrev = 'NC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('RWI', 'Rocky Mount',(SELECT StateID FROM state WHERE Abrev = 'NC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ILM', 'Wilmington',(SELECT StateID FROM state WHERE Abrev = 'NC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('INT', 'Winston Salem',(SELECT StateID FROM state WHERE Abrev = 'NC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BIS', 'Bismarck',(SELECT StateID FROM state WHERE Abrev = 'ND'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DVL', 'Devils Lake',(SELECT StateID FROM state WHERE Abrev = 'ND'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DIK', 'Dickinson',(SELECT StateID FROM state WHERE Abrev = 'ND'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FAR', 'Fargo',(SELECT StateID FROM state WHERE Abrev = 'ND'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GFK', 'Grand Forks',(SELECT StateID FROM state WHERE Abrev = 'ND'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('JMS', 'Jamestown',(SELECT StateID FROM state WHERE Abrev = 'ND'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MOT', 'Minot',(SELECT StateID FROM state WHERE Abrev = 'ND'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ISN', 'Williston',(SELECT StateID FROM state WHERE Abrev = 'ND'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AIA', 'Alliance',(SELECT StateID FROM state WHERE Abrev = 'NE'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GRI', 'Grand Island',(SELECT StateID FROM state WHERE Abrev = 'NE'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('EAR', 'Kearney',(SELECT StateID FROM state WHERE Abrev = 'NE'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LNK', 'Lincoln',(SELECT StateID FROM state WHERE Abrev = 'NE'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MCK', 'Mc Cook',(SELECT StateID FROM state WHERE Abrev = 'NE'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OFK', 'Norfolk',(SELECT StateID FROM state WHERE Abrev = 'NE'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LBF', 'North Platte',(SELECT StateID FROM state WHERE Abrev = 'NE'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OMA', 'Omaha',(SELECT StateID FROM state WHERE Abrev = 'NE'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BFF', 'Scottsbluff',(SELECT StateID FROM state WHERE Abrev = 'NE'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('EEN', 'Keene',(SELECT StateID FROM state WHERE Abrev = 'NH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LEB', 'Lebanon',(SELECT StateID FROM state WHERE Abrev = 'NH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MHT', 'Manchester',(SELECT StateID FROM state WHERE Abrev = 'NH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PSM', 'Portsmouth',(SELECT StateID FROM state WHERE Abrev = 'NH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AIY', 'Atlantic City',(SELECT StateID FROM state WHERE Abrev = 'NJ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BLM', 'Belmar/Farmingdale',(SELECT StateID FROM state WHERE Abrev = 'NJ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CDW', 'Caldwell',(SELECT StateID FROM state WHERE Abrev = 'NJ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ACY', 'Egg Harbor Township',(SELECT StateID FROM state WHERE Abrev = 'NJ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MIV', 'Millville',(SELECT StateID FROM state WHERE Abrev = 'NJ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MMU', 'Morristown',(SELECT StateID FROM state WHERE Abrev = 'NJ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('EWR', 'Newark',(SELECT StateID FROM state WHERE Abrev = 'NJ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TEB', 'Teterboro',(SELECT StateID FROM state WHERE Abrev = 'NJ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MJX', 'Toms River',(SELECT StateID FROM state WHERE Abrev = 'NJ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TTN', 'Trenton',(SELECT StateID FROM state WHERE Abrev = 'NJ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('WWD', 'Wildwood',(SELECT StateID FROM state WHERE Abrev = 'NJ'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ALM', 'Alamogordo',(SELECT StateID FROM state WHERE Abrev = 'NM'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ABQ', 'Albuquerque',(SELECT StateID FROM state WHERE Abrev = 'NM'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CNM', 'Carlsbad',(SELECT StateID FROM state WHERE Abrev = 'NM'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FMN', 'Farmington',(SELECT StateID FROM state WHERE Abrev = 'NM'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GUP', 'Gallup',(SELECT StateID FROM state WHERE Abrev = 'NM'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HOB', 'Hobbs',(SELECT StateID FROM state WHERE Abrev = 'NM'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LRU', 'Las Cruces',(SELECT StateID FROM state WHERE Abrev = 'NM'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ROW', 'Roswell',(SELECT StateID FROM state WHERE Abrev = 'NM'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SRR', 'Ruidoso',(SELECT StateID FROM state WHERE Abrev = 'NM'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SAF', 'Santa Fe',(SELECT StateID FROM state WHERE Abrev = 'NM'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SVC', 'Silver City',(SELECT StateID FROM state WHERE Abrev = 'NM'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SKX', 'Taos',(SELECT StateID FROM state WHERE Abrev = 'NM'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('EKO', 'Elko',(SELECT StateID FROM state WHERE Abrev = 'NV'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ELY', 'Ely',(SELECT StateID FROM state WHERE Abrev = 'NV'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LAS', 'Las Vegas',(SELECT StateID FROM state WHERE Abrev = 'NV'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('VGT', 'Las Vegas',(SELECT StateID FROM state WHERE Abrev = 'NV'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HND', 'Las Vegas',(SELECT StateID FROM state WHERE Abrev = 'NV'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('RNO', 'Reno',(SELECT StateID FROM state WHERE Abrev = 'NV'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ALB', 'Albany',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BGM', 'Binghamton',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BUF', 'Buffalo',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ELM', 'Elmira / Corning',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FRG', 'Farmingdale',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GFL', 'Glens Falls',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ISP', 'Islip',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ITH', 'Ithaca',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('JHW', 'Jamestown',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MSS', 'Massena',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MSV', 'Monticello',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('JFK', 'New York',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LGA', 'New York',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('JRB', 'New York',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SWF', 'Newburgh',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OGS', 'Ogdensburg',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PLB', 'Plattsburgh',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('POU', 'Poughkeepsie',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ROC', 'Rochester',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('RME', 'Rome',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SLK', 'Saranac Lake',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SYR', 'Syracuse',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('UCA', 'Utica',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ART', 'Watertown',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HPN', 'White Plains',(SELECT StateID FROM state WHERE Abrev = 'NY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CVG', 'Cincinnati',(SELECT StateID FROM state WHERE Abrev = 'OH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LUK', 'Cincinnati',(SELECT StateID FROM state WHERE Abrev = 'OH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CLE', 'Cleveland',(SELECT StateID FROM state WHERE Abrev = 'OH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BKL', 'Cleveland',(SELECT StateID FROM state WHERE Abrev = 'OH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CGF', 'Cleveland',(SELECT StateID FROM state WHERE Abrev = 'OH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CMH', 'Columbus',(SELECT StateID FROM state WHERE Abrev = 'OH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LCK', 'Columbus',(SELECT StateID FROM state WHERE Abrev = 'OH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OSU', 'Columbus',(SELECT StateID FROM state WHERE Abrev = 'OH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DAY', 'Dayton',(SELECT StateID FROM state WHERE Abrev = 'OH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LPR', 'Lorain/Elyria',(SELECT StateID FROM state WHERE Abrev = 'OH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MFD', 'Mansfield',(SELECT StateID FROM state WHERE Abrev = 'OH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('3T7', 'Middle Bass',(SELECT StateID FROM state WHERE Abrev = 'OH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CAK', 'North Canton',(SELECT StateID FROM state WHERE Abrev = 'OH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PCW', 'Port Clinton',(SELECT StateID FROM state WHERE Abrev = 'OH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('3W2', 'Put - in - Bay',(SELECT StateID FROM state WHERE Abrev = 'OH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SGH', 'Springfield',(SELECT StateID FROM state WHERE Abrev = 'OH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TOL', 'Toledo',(SELECT StateID FROM state WHERE Abrev = 'OH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('YNG', 'Youngstown',(SELECT StateID FROM state WHERE Abrev = 'OH'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('WDG', 'Enid',(SELECT StateID FROM state WHERE Abrev = 'OK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LAW', 'Lawton',(SELECT StateID FROM state WHERE Abrev = 'OK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OKC', 'Oklahoma City',(SELECT StateID FROM state WHERE Abrev = 'OK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PNC', 'Ponca City',(SELECT StateID FROM state WHERE Abrev = 'OK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SWO', 'Stillwater',(SELECT StateID FROM state WHERE Abrev = 'OK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TUL', 'Tulsa',(SELECT StateID FROM state WHERE Abrev = 'OK'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AST', 'Astoria',(SELECT StateID FROM state WHERE Abrev = 'OR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CVO', 'Corvallis',(SELECT StateID FROM state WHERE Abrev = 'OR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('EUG', 'Eugene',(SELECT StateID FROM state WHERE Abrev = 'OR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LMT', 'Klamath Falls',(SELECT StateID FROM state WHERE Abrev = 'OR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MMV', 'Mc Minnville',(SELECT StateID FROM state WHERE Abrev = 'OR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MFR', 'Medford',(SELECT StateID FROM state WHERE Abrev = 'OR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ONP', 'Newport',(SELECT StateID FROM state WHERE Abrev = 'OR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OTH', 'North Bend',(SELECT StateID FROM state WHERE Abrev = 'OR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PDT', 'Pendleton',(SELECT StateID FROM state WHERE Abrev = 'OR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PDX', 'Portland',(SELECT StateID FROM state WHERE Abrev = 'OR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('RDM', 'Redmond',(SELECT StateID FROM state WHERE Abrev = 'OR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SLE', 'Salem',(SELECT StateID FROM state WHERE Abrev = 'OR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ABE', 'Allentown',(SELECT StateID FROM state WHERE Abrev = 'PA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AOO', 'Altoona',(SELECT StateID FROM state WHERE Abrev = 'PA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AVP', 'Avoca',(SELECT StateID FROM state WHERE Abrev = 'PA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BFD', 'Bradford',(SELECT StateID FROM state WHERE Abrev = 'PA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DUJ', 'Du Bois',(SELECT StateID FROM state WHERE Abrev = 'PA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ERI', 'Erie',(SELECT StateID FROM state WHERE Abrev = 'PA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FKL', 'Franklin',(SELECT StateID FROM state WHERE Abrev = 'PA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MDT', 'Harrisburg',(SELECT StateID FROM state WHERE Abrev = 'PA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('JST', 'Johnstown',(SELECT StateID FROM state WHERE Abrev = 'PA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LNS', 'Lancaster',(SELECT StateID FROM state WHERE Abrev = 'PA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LBE', 'Latrobe',(SELECT StateID FROM state WHERE Abrev = 'PA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PHL', 'Philadelphia',(SELECT StateID FROM state WHERE Abrev = 'PA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PIT', 'Pittsburgh',(SELECT StateID FROM state WHERE Abrev = 'PA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AGC', 'Pittsburgh',(SELECT StateID FROM state WHERE Abrev = 'PA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('RDG', 'Reading',(SELECT StateID FROM state WHERE Abrev = 'PA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('UNV', 'State College',(SELECT StateID FROM state WHERE Abrev = 'PA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('IPT', 'Williamsport',(SELECT StateID FROM state WHERE Abrev = 'PA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BQN', 'Aguadilla',(SELECT StateID FROM state WHERE Abrev = 'PR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('X95', 'Fajardo',(SELECT StateID FROM state WHERE Abrev = 'PR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CPX', 'Isla De Culebra',(SELECT StateID FROM state WHERE Abrev = 'PR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('VQS', 'Isla De Vieques',(SELECT StateID FROM state WHERE Abrev = 'PR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MAZ', 'Mayaguez',(SELECT StateID FROM state WHERE Abrev = 'PR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PSE', 'Ponce',(SELECT StateID FROM state WHERE Abrev = 'PR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SJU', 'San Juan',(SELECT StateID FROM state WHERE Abrev = 'PR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SIG', 'San Juan',(SELECT StateID FROM state WHERE Abrev = 'PR'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BID', 'Block Island',(SELECT StateID FROM state WHERE Abrev = 'RI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('UUU', 'Newport',(SELECT StateID FROM state WHERE Abrev = 'RI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OQU', 'North Kingstown',(SELECT StateID FROM state WHERE Abrev = 'RI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SFZ', 'Pawtucket',(SELECT StateID FROM state WHERE Abrev = 'RI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PVD', 'Providence',(SELECT StateID FROM state WHERE Abrev = 'RI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('WST', 'Westerly',(SELECT StateID FROM state WHERE Abrev = 'RI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AND', 'Anderson',(SELECT StateID FROM state WHERE Abrev = 'SC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CHS', 'Charleston',(SELECT StateID FROM state WHERE Abrev = 'SC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CAE', 'Columbia',(SELECT StateID FROM state WHERE Abrev = 'SC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FLO', 'Florence',(SELECT StateID FROM state WHERE Abrev = 'SC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GSP', 'Greenville',(SELECT StateID FROM state WHERE Abrev = 'SC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GYH', 'Greenville',(SELECT StateID FROM state WHERE Abrev = 'SC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HXD', 'Hilton Head Island',(SELECT StateID FROM state WHERE Abrev = 'SC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MYR', 'Myrtle Beach',(SELECT StateID FROM state WHERE Abrev = 'SC'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ABR', 'Aberdeen',(SELECT StateID FROM state WHERE Abrev = 'SD'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BKX', 'Brookings',(SELECT StateID FROM state WHERE Abrev = 'SD'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HON', 'Huron',(SELECT StateID FROM state WHERE Abrev = 'SD'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MHE', 'Mitchell',(SELECT StateID FROM state WHERE Abrev = 'SD'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PIR', 'Pierre',(SELECT StateID FROM state WHERE Abrev = 'SD'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('RAP', 'Rapid City',(SELECT StateID FROM state WHERE Abrev = 'SD'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FSD', 'Sioux Falls',(SELECT StateID FROM state WHERE Abrev = 'SD'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ATY', 'Watertown',(SELECT StateID FROM state WHERE Abrev = 'SD'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('YKN', 'Yankton',(SELECT StateID FROM state WHERE Abrev = 'SD'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TRI', 'Blountville',(SELECT StateID FROM state WHERE Abrev = 'TN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CHA', 'Chattanooga',(SELECT StateID FROM state WHERE Abrev = 'TN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MKL', 'Jackson',(SELECT StateID FROM state WHERE Abrev = 'TN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TYS', 'Knoxville',(SELECT StateID FROM state WHERE Abrev = 'TN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MEM', 'Memphis',(SELECT StateID FROM state WHERE Abrev = 'TN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('NQA', 'Millington',(SELECT StateID FROM state WHERE Abrev = 'TN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BNA', 'Nashville',(SELECT StateID FROM state WHERE Abrev = 'TN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MQY', 'Smyrna',(SELECT StateID FROM state WHERE Abrev = 'TN'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ABI', 'Abilene',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AMA', 'Amarillo',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LBX', 'Angleton/Lake Jackson',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('AUS', 'Austin',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BPT', 'Beaumont / Port Arthur',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BRO', 'Brownsville',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CLL', 'College Station',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CRP', 'Corpus Christi',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DAL', 'Dallas',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DFW', 'Dallas',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DRT', 'Del Rio',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ELP', 'El Paso',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GRK', 'Fort Hood / Killeen',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FTW', 'Fort Worth',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GLS', 'Galveston',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HRL', 'Harlingen',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('EFD', 'Houston',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HOU', 'Houston',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('IAH', 'Houston',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ILE', 'Killeen',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LRD', 'Laredo',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GGG', 'Longview',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LBB', 'Lubbock',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MFE', 'Mcallen',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MAF', 'Midland',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SJT', 'San Angelo',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SAT', 'San Antonio',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TPL', 'Temple',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('TYR', 'Tyler',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('VCT', 'Victoria',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ACT', 'Waco',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SPS', 'Wichita Falls',(SELECT StateID FROM state WHERE Abrev = 'TX'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BCE', 'Bryce Canyon',(SELECT StateID FROM state WHERE Abrev = 'UT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CDC', 'Cedar City',(SELECT StateID FROM state WHERE Abrev = 'UT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CNY', 'Moab',(SELECT StateID FROM state WHERE Abrev = 'UT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OGD', 'Ogden',(SELECT StateID FROM state WHERE Abrev = 'UT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PVU', 'Provo',(SELECT StateID FROM state WHERE Abrev = 'UT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SLC', 'Salt Lake City',(SELECT StateID FROM state WHERE Abrev = 'UT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SGU', 'St George',(SELECT StateID FROM state WHERE Abrev = 'UT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CHO', 'Charlottesville',(SELECT StateID FROM state WHERE Abrev = 'VA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DAN', 'Danville',(SELECT StateID FROM state WHERE Abrev = 'VA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SHD', 'Harrisonburg',(SELECT StateID FROM state WHERE Abrev = 'VA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LYH', 'Lynchburg',(SELECT StateID FROM state WHERE Abrev = 'VA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PHF', 'Newport News',(SELECT StateID FROM state WHERE Abrev = 'VA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ORF', 'Norfolk',(SELECT StateID FROM state WHERE Abrev = 'VA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('RIC', 'Richmond',(SELECT StateID FROM state WHERE Abrev = 'VA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ROA', 'Roanoke',(SELECT StateID FROM state WHERE Abrev = 'VA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('STT', 'Charlotte Amalie',(SELECT StateID FROM state WHERE Abrev = 'VI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('STX', 'Christiansted',(SELECT StateID FROM state WHERE Abrev = 'VI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MPV', 'Barre/Montpelier',(SELECT StateID FROM state WHERE Abrev = 'VT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('DDH', 'Bennington',(SELECT StateID FROM state WHERE Abrev = 'VT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MVL', 'Morrisville',(SELECT StateID FROM state WHERE Abrev = 'VT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('EFK', 'Newport',(SELECT StateID FROM state WHERE Abrev = 'VT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('RUT', 'Rutland',(SELECT StateID FROM state WHERE Abrev = 'VT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BTV', 'South Burlington',(SELECT StateID FROM state WHERE Abrev = 'VT'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('74S', 'Anacortes',(SELECT StateID FROM state WHERE Abrev = 'WA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BLI', 'Bellingham',(SELECT StateID FROM state WHERE Abrev = 'WA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PWT', 'Bremerton',(SELECT StateID FROM state WHERE Abrev = 'WA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ORS', 'Eastsound',(SELECT StateID FROM state WHERE Abrev = 'WA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PAE', 'Everett',(SELECT StateID FROM state WHERE Abrev = 'WA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('FHR', 'Friday Harbor',(SELECT StateID FROM state WHERE Abrev = 'WA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MWH', 'Moses Lake',(SELECT StateID FROM state WHERE Abrev = 'WA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OLM', 'Olympia',(SELECT StateID FROM state WHERE Abrev = 'WA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PSC', 'Pasco',(SELECT StateID FROM state WHERE Abrev = 'WA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CLM', 'Port Angeles',(SELECT StateID FROM state WHERE Abrev = 'WA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PUW' ,'Pullman / Moscow',(SELECT StateID FROM state WHERE Abrev = 'WA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SEA', 'Seattle',(SELECT StateID FROM state WHERE Abrev = 'WA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BFI', 'Seattle',(SELECT StateID FROM state WHERE Abrev = 'WA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GEG', 'Spokane',(SELECT StateID FROM state WHERE Abrev = 'WA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ALW', 'Walla Walla',(SELECT StateID FROM state WHERE Abrev = 'WA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('EAT', 'Wenatchee',(SELECT StateID FROM state WHERE Abrev = 'WA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('YKM', 'Yakima',(SELECT StateID FROM state WHERE Abrev = 'WA'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ATW', 'Appleton',(SELECT StateID FROM state WHERE Abrev = 'WI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('EAU', 'Eau Claire',(SELECT StateID FROM state WHERE Abrev = 'WI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GRB', 'Green Bay',(SELECT StateID FROM state WHERE Abrev = 'WI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('JVL', 'Janesville',(SELECT StateID FROM state WHERE Abrev = 'WI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('ENW', 'Kenosha',(SELECT StateID FROM state WHERE Abrev = 'WI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LSE', 'La Crosse',(SELECT StateID FROM state WHERE Abrev = 'WI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MSN', 'Madison',(SELECT StateID FROM state WHERE Abrev = 'WI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MKE', 'Milwaukee',(SELECT StateID FROM state WHERE Abrev = 'WI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CWA', 'Mosinee',(SELECT StateID FROM state WHERE Abrev = 'WI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('OSH', 'Oshkosh',(SELECT StateID FROM state WHERE Abrev = 'WI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('RHI', 'Rhinelander',(SELECT StateID FROM state WHERE Abrev = 'WI'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('BKW', 'Beckley',(SELECT StateID FROM state WHERE Abrev = 'WV'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CRW', 'Charleston',(SELECT StateID FROM state WHERE Abrev = 'WV'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CKB', 'Clarksburg',(SELECT StateID FROM state WHERE Abrev = 'WV'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('HTS', 'Huntington',(SELECT StateID FROM state WHERE Abrev = 'WV'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LWB', 'Lewisburg',(SELECT StateID FROM state WHERE Abrev = 'WV'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('MGW', 'Morgantown',(SELECT StateID FROM state WHERE Abrev = 'WV'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('PKB', 'Parkersburg',(SELECT StateID FROM state WHERE Abrev = 'WV'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CPR', 'Casper',(SELECT StateID FROM state WHERE Abrev = 'WY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('CYS', 'Cheyenne',(SELECT StateID FROM state WHERE Abrev = 'WY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('COD', 'Cody',(SELECT StateID FROM state WHERE Abrev = 'WY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('GCC', 'Gillette',(SELECT StateID FROM state WHERE Abrev = 'WY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('JAC', 'Jackson',(SELECT StateID FROM state WHERE Abrev = 'WY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('LAR', 'Laramie',(SELECT StateID FROM state WHERE Abrev = 'WY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('RIW', 'Riverton',(SELECT StateID FROM state WHERE Abrev = 'WY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('RKS', 'Rock Springs',(SELECT StateID FROM state WHERE Abrev = 'WY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('SHR', 'Sheridan',(SELECT StateID FROM state WHERE Abrev = 'WY'));
INSERT INTO city (Abrev, Name, fk_stateID) VALUES ('WRL', 'Worland',(SELECT StateID FROM state WHERE Abrev = 'WY'));




Here is an ERD

Here is my PHP (using pg_connect as this is just a test - will change this to PDO later)
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

$host = "host=127.0.0.1";
$port = "port=5432";
$dbname = "dbname=test";
$credentials = "user=test password=test";

$db = pg_connect("$host $port $dbname $credentials");


if (!$db) {
    echo "Error : Unable to open database\n";
} else {

    $listOfStates = pg_query($db, "SELECT stateID ,name FROM state");
    if (!$listOfStates) {
        echo "An error occured";
        exit;
    }

    echo "<form method=\"post\" action=\"#\">";
    echo '<select name="states">'; // Open your drop down box
    while ($state_row = pg_fetch_row($listOfStates)) {
        echo '<option value="' . $state_row[1] . '">' . $state_row[1] . '</option>';
    }
    echo '</select>';// Close your drop down box


    // fk_stateid should be genorated from above statement.
    $listOfCitysInState = "SELECT name FROM city WHERE fk_stateid = 1";

    echo '<select name="citys">'; // Open your drop down box
    while ($city_row = pg_fetch_row($listOfCitysInState)) {
        echo '<option value="' . $city_row[0] . '">' . $city_row[0] . '</option>';
    }
    echo '</select>';
    echo '</select>';
    echo '</form>';
}
?>



So what I think I need to do at this point (correct me if I am wrong)
1. capture a post and send the "stateID" to a new select statement as such.
SELECT name FROM city WHERE fk_stateid = "stateID"


2. Then reload the page dynamically to reflect the change (ajax? javascript? )


The problems that I can see now. is the scope of my first select statement does not live outside the while loop.
Also not sure what is the best approach to reload the page.

Any feedback appreciated.
Let me know if something is not clear.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2