Answered step by step
Verified Expert Solution
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 autoincrement, firstName varcharlastName varcharcountry varcharengineInnoDB, collatelatingeneralcs;create table BandMember bandMemberId int not null primary key autoincrement, musicianId int not null,bandId int not null,yearJoined int,foreign key musicianId references MusicianmusicianIdforeign key bandId references BandbandId#prevent duplicate entriesconstraint uniquePair unique indexmusicianId bandIdengineInnoDB, collatelatingeneralcs; create table Album albumId int not null primary key autoincrement, title varchar not null, year int not null, number int not null, bandId int not null, foreign key bandId Yreferences BandbandId engineInnoDB, collatelatingeneralcs; create table Song songId int not null primary key autoincrement, title varchar not null engineInnoDB, collatelatingeneralcs; create table AlbumSong albumSongId int not null primary key autoincrement, trackNumber int not null, trackLength int not null, albumId int not null, songId int not null, foreign key albumId references AlbumalbumId foreign key songId references SongsongId #prevent duplicate entries constraint uniquePair unique indexalbumIdsongId engineInnoDB, collatelatingeneralcs; Grouped Join Queries 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 Write a query that lists all albums in the database along with the number of tracks on them. Write the same query, but limit it to albums which have or more tracks on them. Write a query to find all musicians that are not in any bands. Write a query to find all musicians that are in more than one band.
mysql please
create table Musician musicianId int not nll primary key autoincrement, firstName varcharlastName varcharcountry varcharengineInnoDB, collatelatingeneralcs;create table BandMember bandMemberId int not null primary key autoincrement, musicianId int not null,bandId int not null,yearJoined int,foreign key musicianId references MusicianmusicianIdforeign key bandId references BandbandId#prevent duplicate entriesconstraint uniquePair unique indexmusicianId bandIdengineInnoDB, collatelatingeneralcs;
create table Album
albumId int not null primary key autoincrement, title varchar not null,
year int not null,
number int not null,
bandId int not null,
foreign key bandId Yreferences BandbandId
engineInnoDB, collatelatingeneralcs;
create table Song
songId int not null primary key autoincrement, title varchar not null
engineInnoDB, collatelatingeneralcs;
create table AlbumSong
albumSongId int not null primary key autoincrement,
trackNumber int not null,
trackLength int not null,
albumId int not null,
songId int not null,
foreign key albumId references AlbumalbumId
foreign key songId references SongsongId
#prevent duplicate entries
constraint uniquePair unique indexalbumIdsongId
engineInnoDB, collatelatingeneralcs;
Grouped Join Queries
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
Write a query that lists all albums in the database along with the
number of tracks on them.
Write the same query, but limit it to albums which have or more
tracks on them.
Write a query to find all musicians that are not in any bands.
Write a query to find all musicians that are in more than one band.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started