List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:August 1 2002 5:43pm
Subject:Re: INSERT Question
View as plain text  
Since the US Postal Service has official 2 character codes for each 
state, why not use them?
You could use an enum type, or validate against a 1 column state table. 
 Why complicate every query with a join to as state

Steven Kreuzer wrote:

> Hello All,
> First, Let me start by saying this question has most likely been asked 
> before, but I did a search in the archive and was unable to come up 
> with any results. I think this  is because I am not quite sure what 
> this is called. So, I do apologize, but hopefully this can be answered 
> quickly and will really help me out.
> This is more of a General SQL question, regarding sytanx.
> I have 3 table I am going to be working on. contact, address and state.
> state contains 51 states (Washington D.C is listed as a state) each 
> with their unique ID. Contact contains a persons first and last name, 
> as well as their own ID. Address contains their street name, the city, 
> state and a column called contactid for the id of the person who lives 
> there.
> State is a foreign key for the state table and contactid is a foreign 
> key for the contact's id.
> Now here is what I want to do:
> I want to insert a person into the contact database and then insert 
> their address into the address table, but I want to somehow put the ID 
> of the state, and the id of the contact into the fields without 
> actually  having to know the values.
> Like rather then having to look up New York and then insert 033, can I 
> just somehow put "New York"?
> Is this possible to do?
> Many thanks
> -Steven
> mysql, sql, query
> ---------------------------------------------------------------------
> Before posting, please check:
>   (the manual)
>           (the list archive)
> To request this thread, e-mail <mysql-thread116131@stripped>
> To unsubscribe, e-mail 
> <>
> Trouble unsubscribing? Try:

INSERT QuestionSteven Kreuzer1 Aug
  • Re: INSERT QuestionGerald Clark1 Aug