Schema Questions and SQL Examples
Can you show the relationship between all the tables in the ChEMBL database?
A PNG of the schema relationships can be found on the FTP site in the latest release directory: ftp://ftp.ebi.ac.uk/pub/databases/chembl/ChEMBLdb/latest
It is also possible to view an interactive schema diagram on the ChEMBL interface: https://www.ebi.ac.uk/chembl/db_schema
Retrieve all the bioactivity data for bacterial targets:
SELECT md.chembl_id AS compound_chembl_id,
cs.canonical_smiles,
act.standard_type,
act.standard_value,
act.standard_units,
td.chembl_id AS target_chembl_id,
td.organism, td.pref_name
FROM target_dictionary td
JOIN assays a ON td.tid = a.tid
JOIN activities act ON a.assay_id = act.assay_id
JOIN molecule_dictionary md ON act.molregno = md.molregno
JOIN compound_structures cs ON md.molregno = cs.molregno
JOIN organism_class oc ON td.tax_id = oc.tax_id
AND oc.L1 = 'Bacteria';Retrieve activity details for compound and all its salts which have an IC50 bioactivity value in nM against a target of interest:
Retrieve compounds which are selective to one target over a second target:
Retrieve target ChEMBL_ID, target_name, target_type, protein accessions and sequences for all protein targets:
Retrieve PK data from 'Curated Drug Pharmacokinetic Data' source in ChEMBL for drug:
Retrieve compound activity details for all targets containing a protein of interest:
Retrieve compound activity details for a target:
Can you show me how to use SQL to only extract the PubChem data from ChEMBL?
Last updated