Tango.info music sql query list

From tango.info wiki
Jump to navigation Jump to search

Sublist of tango.info sql query list

Track and work

SELECT *
FROM ti_track t
LEFT JOIN ti_work w
ON
t.work_id=w.tiwc
WHERE t.work_id <>  ""

Track and work - no work rights

SELECT *
FROM ti_track t
LEFT JOIN ti_work w
ON
t.work_id=w.tiwc
WHERE
t.work_id <> ""
AND 
dp_c="C"
AND 
 ( track_lang="zxx" OR dp_a ="A") 
SELECT tinp,product_side,track_num,track_format,
work_id,track_name,track_genr,track_orch,track_voca,track_date,track_lang,composer,lyricist,dp_a

FROM ti_track t
LEFT JOIN ti_work w
ON
t.work_id=w.tiwc
WHERE
t.work_id <> ""
/* composition free */
AND dp_c="C"
/* (no language) or (text free) */
AND ( track_lang="zxx" OR dp_a ="A") 

/* only YYYY, YYYY-MM, YYYY-MM-DD */
AND track_date RLIKE '^[0-9]{4}(-[0-9]{2}){0,2}$'

/* 50 year copyright term for sound recordings 
may be higher in some jurisdictions
*/
AND track_date < 1962

/* group track to performances - 
 which TINT and genre shows up in the results is not defined */
GROUP BY track_name,track_orch, track_voca,track_date,track_lang

Work having track and having composer with non t.i person code elements

SELECT work_id, track_name, track_orch, track_voca, composer, lyricist, dp_a, dp_c
FROM ti_track t
LEFT JOIN ti_work w ON t.work_id = w.tiwc
WHERE t.work_id <>  ""/* composition free */#AND dp_c="C"
/* (no language) or (text free) */#AND ( track_lang="zxx" OR dp_a ="A") 
/* only YYYY, YYYY-MM, YYYY-MM-DD */
AND track_date
RLIKE  '^[0-9]{4}(-[0-9]{2}){0,2}$'/* 50 year copyright term for sound recordings may be higher in some jurisdictions */#AND track_date < 1962

AND (
composer
REGEXP  "[0-9]"
)/* group track to performances - which TINT and genre shows up in the results is not defined */
GROUP BY tiwc
ORDER BY composer ASC , lyricist ASC 

Work that is a deletion candidate

SELECT distinct(w.tiwc),w.work_name_orig,
w.composer,w.lyricist,w.comp_type,w.source
FROM ti_work w
LEFT JOIN ti_track t
ON w.work_name_asci = t.track_name_az
WHERE 
w.tiwc RLIKE '^Z09'

/* track has no tiwc, if it had one 
that would not start with Z09
and therefore related to another work
therefore it cannot be used as an evidence that 
a Z09 work might have a track*/
AND (t.work_id = "" OR t.work_id IS NULL)

/* select only work where no track
has the same name */
AND (t.tinp IS NULL)

/* limit genres, exclude works without genre*/
AND w.comp_type NOT RLIKE '(tango|milonga|vals)'

Product with no track in t.i but with external product link

SELECT * 
FROM ti_product p, ti_product_external pe
WHERE track_qty =0
AND p.tinp = pe.tinp
AND pe.site =  "xyz"
ORDER BY  p.`product_artist` ASC

Track duration

See tango.info track duration sql

Work

SELECT *
FROM ti_work_x_cjjsetblog_unique_tiwc
LEFT JOIN  ti_work
ON
ti_work_x_cjjsetblog_unique_tiwc.tiwc=ti_work.tiwc

show tiwc present in ti_track but not in ti_work

SELECT DISTINCT(work_id),tiwc
FROM ti_track
LEFT JOIN  ti_work
ON
ti_track.work_id=ti_work.tiwc 
WHERE tiwc is NULL
ORDER BY `ti_track`.`work_id` ASC