SQL - ORDER BY count(r.movie_id); SELECT b.first, b.last,...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
SELECT table_name FROM user_tables WHERE table_name LIKE 'MM%'; DESC mm_movie_type; DESC mm_pay_type; DESC mm_member; DESC mm_movie; DESC mm_rental; SET LINESIZE 650 SET PAGESIZE 20000 SELECT * FROM mm_movie_type; SELECT * FROM mm_pay_type; SELECT * FROM mm_member; SELECT * FROM mm_movie; SELECT * FROM mm_rental; SELECT mt. movie_category, count(m.movie_id) FROM mm_movie_type mt, mm_movie m WHERE mt. movie_cat_id = m. movie_cat_id GROUP BY mt. movie_category; SELECT m.movie_title, r.checkout_date FROM mm_movie m, mm_rental r WHERE m.movie_id = r.movie_id AND r.member_id = 13; SELECT m.movie_title,m.movie_id FROM mm_movie m WHERE m.movie_id NOT IN (SELECT DISTINCT movie_id FROM mm_rental); SELECT m.member_id, m.first, m.last, count(r.movie_id) FROM mm_member m, mm_rental r WHERE m.member_id = r.member_id GROUP BY m.member_id, m.first, m.last HAVING count(r.movie_id) > 1
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ORDER BY count(r.movie_id); SELECT b.first, b.last, a.max_num as "MAXIMUM NUMBER" FROM (SELECT MAX(movie_count) max_num FROM (SELECT m.first, m.last, COUNT(r.movie_id) as movie_count FROM mm_member m, mm_rental r WHERE m.member_id = r.member_id GROUP BY m.first, m.last)) a, (SELECT m.first, m.last, COUNT(r.movie_id) as movie_count FROM mm_member m, mm_rental r WHERE m.member_id = r.member_id GROUP BY m.first, m.last) b WHERE a.max_num = b.movie_count; SELECT m.first, m.last, count(r.movie_id) as "NUMBER RENTED" FROM mm_member m, mm_rental r WHERE m.member_id = r.member_id GROUP BY m.member_id, m.first, m.last; SELECT m.first, m.last, mv.movie_title, count(r.movie_id) FROM mm_member m, mm_rental r, mm_movie mv WHERE m.member_id = r.member_id AND mv.movie_id = r.movie_id GROUP BY m.first, m.last, mv.movie_title;...
View Full Document

This note was uploaded on 06/11/2011 for the course DBM 405 taught by Professor Panja during the Spring '11 term at DeVry Columbus North.

Ask a homework question - tutors are online