I need the query or command you used within MySQL for each of these questions. H
ID: 3720809 • Letter: I
Question
I need the query or command you used within MySQL for each of these questions.
Here is a part of the 40 some-odd tables shown when you run the command show tables;
...
| cm_genes |
| cm_proteins |
| cv |
| cvterm |
| cvterm_dbxref |
| cvterm_relationship |
| cvtermpath |
| cvtermprop |
| cvtermsynonym |
| db |
...
Here is the cv table shown with describe cv;
+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| cv_id | int(11) | NO | PRI | NULL | |
| name | varchar(255) | NO | UNI | NULL | |
| definition | varchar(255) | YES | | NULL | |
+------------+--------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
These are the questions
1) Which ID (cv_id) corresponds to the GO ontology stored in the database?
2) How many controlled vocabulary terms (cvterm table) are linked to the GO ontology?
3) Which ontology in the database has the most linked terms?
Explanation / Answer
1) SELECT cv_id FROM cv WHERE name = 'GO';
2) SELECT count(*) FROM cv, cvterm WHERE cv.cv_id = cvterm.cv_id AND cv.name='GO';
3) SELECT a.name, max(a.NumTerms) FROM ( SELECT cv.name, count(*) AS NumTerms FROM cv, cvterms WHERE cv.cv_id = cvterms.cv_id GROUP BY cv.name) AS a;
NOTE: To get more accurate queries, you need to provide the description of other tables too.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.