Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

mysql please create table Musician ( musicianId int not n ll primary key auto _ increment, firstName varchar ( 5 0 ) , lastName varchar

mysql please
create table Musician (musicianId int not nll primary key auto_increment, firstName varchar(50),lastName varchar(50),country varchar(100))engine=InnoDB, collate=latin1_general_cs;create table BandMember (bandMemberId int not null primary key auto_increment, musicianId int not null,bandId int not null,yearJoined int,foreign key (musicianId) references Musician(musicianId),foreign key (bandId) references Band(bandId),#prevent duplicate entriesconstraint uniquePair unique index(musicianId, bandId))engine=InnoDB, collate=latin1_general_cs;
create table Album (
albumId int not null primary key auto_increment, title varchar(100) not null,
year int not null,
number int not null,
bandId int not null,
foreign key (bandId) Yreferences Band(bandId)
engine=InnoDB, collate=latin1_general_cs;
create table Song (
songId int not null primary key auto_increment, title varchar(255) not null
engine=InnoDB, collate=latin1_general_cs;
create table AlbumSong (
albumSongId int not null primary key auto_increment,
trackNumber int not null,
trackLength int not null,
albumId int not null,
songId int not null,
foreign key (albumId) references Album(albumId),
foreign key (songId) references Song(songId),
#prevent duplicate entries
constraint uniquePair unique index(albumId,songId)
engine=InnoDB, collate=latin1_general_cs;
-- Grouped Join Queries
--12. Write a query list all bands along with a of how many albums
-- they have in the database (as you saw in the previous query, some should
-- have zero).
--13. Write a query that lists all albums in the database along with the
-- number of tracks on them.
--14. Write the same query, but limit it to albums which have 12 or more
-- tracks on them.
--15. Write a query to find all musicians that are not in any bands.
--16. Write a query to find all musicians that are in more than one band.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions