How to use MySQL to solve this question For each topic find
How to use MySQL to solve this question?
For each topic, find the total number of blurts that were analyzed as being related to the topic. Order the result by topic id. Your SQL query should print the topic id, topic description and the corresponding count.
user (email, password, name, date_of _birth, address, type) primary keyemail) celebrity (email, website, kind) primary keyemail) blurt (blurtid, email, textlocation, time) primary keyblurtid,email ) foreign key (email) references user(email) hobby (email, hobby) primary key emailhobb, ) foreign key(email) references user(email) . follow (follower, followee) primary key(follower.followee) foreign key follower) references user(email) foreign keyfollowee) references user(email) vendor (id, name rimary keyid) vendorambassador (vendorid. email) primary keyvendorid) foreign key(email) references user email) foreign keyvendorid) references vendor(id) topic (id, description) primary keyid) vendor_topics (vendorid, topicid) primary keyvendorid, topicid) foreign keyvendorid) references vendor(id) foreign keytopicid) references topic(id)Solution
select t.id,t.description,count(ba.blurtid) from Topic t,BlurtAnalysis ba where t.id=ba.topicid group by ba.topicid order by ba.topicid asc;
