From: | Melvin Davidson <melvin6925(at)gmail(dot)com> |
---|---|
To: | Sherman Willden <operasopranos(at)gmail(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Display table entries using partial column entry |
Date: | 2017-12-10 23:10:25 |
Message-ID: | CANu8Fixr+Nnjpx7sHB_o12QgSpQN6xr0U3RHUAjLW2w2W0OhnQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sun, Dec 10, 2017 at 4:50 PM, Sherman Willden <operasopranos(at)gmail(dot)com>
wrote:
> The database table has five columns; 'id aria artist a_artist
> album_title'. I assume I will use a SELECT * FROM aria_precis WHERE type
> command.
>
> I want to access all arias that have mio ben within the aria title. In the
> example below I want to display cbiylm06 and cbiylm10.
>
> cbiylm06#Caro mio ben#Cecilia Bartoli##Se tu m'ami
> cbiylm07#Pur dicesti, o bocca bella#Cecilia Bartoli##Se tu m'ami
> cbiylm08#Intorno all'idol mio#Cecilia Bartoli##Se tu m'ami
> cbiylm09#Nel cor più non mi sento#Cecilia Bartoli##Se tu m'ami
> cbiylm10#Il mio ben quando ve#Cecilia Bartoli##Se tu m'ami
> cbiylm11#O Leggiadri Occhi Belli#Cecilia Bartoli##Se tu m'ami
> cbiylm12#Il mio bel foco#Cecilia Bartoli##Se tu m'ami
>
> Thank you;
>
> Sherman
>
Sherman,
In the future, please be kind enough to provide PostgreSQL version and O/S
when posting to this listing.
Also include COLUMN HEADERS with all data and present the data formatted so
it is easily readable by humans.
Presuming the # is your column divider, and the data you have provided
looks like this:
id #aria #artist
#a_artist #album_title
cbiylm06 #Caro mio ben #Cecilia Bartoli
# #Se tu m'ami
cbiylm07 #Pur dicesti, o bocca bella #Cecilia Bartoli #
#Se tu m'ami
cbiylm08 #Intorno all'idol mio #Cecilia Bartoli
# #Se tu m'ami
cbiylm09 #Nel cor più non mi sento #Cecilia Bartoli #
#Se tu m'ami
cbiylm10 #Il mio ben quando ve #Cecilia Bartoli #
#Se tu m'ami
cbiylm11 #O Leggiadri Occhi Belli #Cecilia Bartoli #
#Se tu m'ami
cbiylm12 #Il mio bel foco #Cecilia Bartoli
# #Se tu m'ami
Then all you really need is:
SELECT *
FROM aria_precis
WHERE aria LIKE '%mio ben%';
Pattern Matching
https://www.postgresql.org/docs/9.6/static/functions-matching.html
--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.
From | Date | Subject | |
---|---|---|---|
Next Message | Gmail | 2017-12-10 23:39:59 | Re: Display table entries using partial column entry |
Previous Message | Jeff Janes | 2017-12-10 23:07:02 | Re: transaction wrap around |