由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - sql question?
相关主题
Help- A simple question about SQLMS SQL Server 2k question
A SQL question如何only update the first occurrence in a table
Help! How to deal with SYNONYME in MySQL求助:sql server 2000, 这句话怎么写?
help on store procedure of db2[转载] what's wrong with this PL/SQL
primary key?jdbc to db2 on linux问题
another question--怎么delete a row from a tableHow to load data into Mysql from txt file?
如何用SQL语句判断一个TABLE是否存在?the most stupid question
How to insert image to DB2 ?请教如何用alter table 来加一个not null的列
相关话题的讨论汇总
话题: ids话题: clone话题: gene话题: cid话题: sql
进入Database版参与讨论
1 (共1页)
s******e
发帖数: 493
1
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.
My ans:
select count(gene_ids.gid)
from gene_ids inner join clone_ids on gene_ids.cid = clone_ids.cid
group by (clone_ids.cid)
or
select(count(gene_ids.gid)
from gene_ids, clone_ids
where gene_ids.cid = clone_ids.cid
group by (clone_ids.cid)
Are they correct?
n****f
发帖数: 905
2
How many table you have? 2 or 1 ?
Could you please show the structre and data?
What the data looks like then?

gene
How

【在 s******e 的大作中提到】
: 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.
: My ans:
: select count(gene_ids.gid)
: from gene_ids inner join clone_ids on gene_ids.cid = clone_ids.cid
: group by (clone_ids.cid)
: or
: select(count(gene_ids.gid)

b**e
发帖数: 2
3
There is A table, right?
SELECT clone_ids, count(*) FROM tableName group by clone_ids

gene
How

【在 s******e 的大作中提到】
: 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.
: My ans:
: select count(gene_ids.gid)
: from gene_ids inner join clone_ids on gene_ids.cid = clone_ids.cid
: group by (clone_ids.cid)
: or
: select(count(gene_ids.gid)

1 (共1页)
进入Database版参与讨论
相关主题
请教如何用alter table 来加一个not null的列primary key?
sql server 2k DTS 问题 请教another question--怎么delete a row from a table
How to find primary key如何用SQL语句判断一个TABLE是否存在?
How to delete column and row in tableHow to insert image to DB2 ?
Help- A simple question about SQLMS SQL Server 2k question
A SQL question如何only update the first occurrence in a table
Help! How to deal with SYNONYME in MySQL求助:sql server 2000, 这句话怎么写?
help on store procedure of db2[转载] what's wrong with this PL/SQL
相关话题的讨论汇总
话题: ids话题: clone话题: gene话题: cid话题: sql