All,
There is a table with gene_ids ('gid') and clone_ids ('cid'). Each gene only resides on a single clone and each clone may contain multiple genes. How do you find how many genes are on each and every clone? Please provide the SQL.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
I probably missed something but at first glance I would do...
Code:
select cid "Clones",
count(*) "Genes"
from thetablewhereyourddatais
group by cid
order by cid;
As long as the cid, gid columns are unique in the table where aph is running the query, then your answer is correct. I just wrote it so that it would not matter if they were unique or not.
As long as the cid, gid columns are unique in the table where aph is running the query, then your answer is correct. I just wrote it so that it would not matter if they were unique or not.
Reading poster's specs about "Each gene only resides on a single clone..." I supposed data was compliant with the specs. I've to agree if data is a mess your solution might show a closer solution.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Bookmarks