If I understand this question correctly it is not so much about the format of the SQL results, as about the manner in which exons of a transcript are represented at UCSC. For mRNAs and ESTs, UCSC represents all exons of a transcript as a "block" on one line (the PSL format), with tStarts and blockSizes as two lists of comma separated values.
While Keith's query will give the chr, start and end of the entire mRNA/EST span, it won't give the individual blocks as one line for multi-exonic entities, e.g.:
mysql -B -h genome-mysql.cse.ucsc.edu -A -u genome -D hg19 -e 'select tname, tStart, tEnd, tStarts, blockSizes from all_est limit 10'
tName tStart tEnd tStarts blockSizes
chr1 14405 14592 14405, 187,
chr1 14509 14778 14509,14599, 89,179,
chr1 14654 15884 14654,14784,14969,15795,15846, 129,45,69,50,38,
chr1 15799 17055 15799,15820,15827,15839,15845,16868, 12,7,12,5,60,187,
chr1 16441 16763 16441, 322,
chr1 16441 18056 16441,17656,17914, 188,86,142,
chr1 16618 17298 16618,16856,16909,16921,17232, 150,52,11,134,66,
chr1 16669 17296 16669,16731,16856,16909,16921,16966,17094,17236, 59,37,52,11,44,89,4,60,
chr1 16696 24803 16696,17617,17710,17914,18267,24737, 42,92,32,147,99,66,
chr1 16745 16934 16745,16857,16911,16925, 20,53,13,9,
To get each exon out as one line requires splitting the tStarts and blockSizes lists and adding blockSizes to tStarts to get tEnds. This is one downside of the way genes are modeled in UCSC, and where Ensembl is better since it stores each exon as a separate entity with its own id.
One way to get each exon in a given region as separate lines in BED-like tab-delimited format is to use BioMart's MartService with this script and the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Query>
<Query virtualSchemaName = "default" formatter = "TSV" header = "0" uniqueRows = "0" count = "" datasetConfigVersion = "0.6" >
<Dataset name = "hsapiens_gene_ensembl" interface = "default" >
<Filter name = "chromosome_name" value = "1"/>
<Filter name = "end" value = "30000"/>
<Filter name = "start" value = "10000"/>
<Attribute name = "chromosome_name" />
<Attribute name = "exon_chrom_start" />
<Attribute name = "exon_chrom_end" />
<Attribute name = "ensembl_exon_id" />
</Dataset>
</Query>
Of course you'll need to modify your species & chromosomal regions and append the "chr" to the chromosome name to make it proper BED format.
And I thought I had got away with quietly "forgetting" the composite values!