statement code to find state capitals

Posted on 2011-05-12
Last Modified: 2012-05-11
How do I code the following statement:

What are the capitals of the following states:  Alabama, Washington, and California?
Question by:KayMJay
    1 Comment
    LVL 73

    Accepted Solution

    lots of different possible ways, but they all come down to one basic idea.

    the capital must be stored somewhere with state as an identifying characteristic.

    That could be XML with state nodes and capital attributes
    state nodes with capital subnodes

    relational tables with states and capital child tables
    or a single table

    the last option is probably the simplest and might look something like this...

    select state, capital from state_table
    where state in ('Alabama','Washington','California')

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
    Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now