QAC work (2).sql

# QAC work (2).sql - use hw3 Problem 1 create table table1 as...

• Homework Help
• 2

This preview shows page 1 - 2 out of 2 pages.

use hw3; /* Problem 1 */ create table table1 as select * from lv_biz_cat where cat = "Korean"; create table table2 as select * from lv_biz_cat where cat = "Bars"; create table table3 as select * from lv_biz_cat where cat = "Karaoke"; select distinct table1.id as ID_Num from (table1, table2, table3) inner join table1 t1 on table1.id = table2.id inner join table2 t2 on table2.id = table3.id; /* We have determined the ID of this company to be 'enZkooanyewGsjkxztL6mw' */ /* Problem 2 */ select lv_biz_addr.name as Name, lv_biz_addr.full_addr as Address, group_concat(lv_biz_cat.cat separator ', ') as Categories from (lv_biz_addr, lv_biz_cat) inner join lv_biz_addr Addr on Addr.id = lv_biz_cat.id where lv_biz_addr.id = 'enZkooanyewGsjkxztL6mw' and lv_biz_cat.id = 'enZkooanyewGsjkxztL6mw'; /* Problem 3 */ select lv_review.b_id as BusinessID, lv_review.u_id as UserID, pair.Total from lv_review inner join (select b_id, u_id, count(*) as Total from lv_review group by b_id, u_id having count(*) > 5) pair ON lv_review.b_id = pair.b_id and lv_review.u_id = pair.u_id group by lv_review.b_id, lv_review.u_id;

Subscribe to view the full document.

• Spring '17
• Set Theory, Category, Algebraic structure, INNER JOIN

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern