subject

The SQL below creates Genre and Song tables, inserts some genres and songs, and performs an inner join. Run the SQL. Verify the result table does not include songs with NULL genre or genres that are not associated with songs. Make the following changes: In the CREATE TABLE statement for Song, rename GenreCode to Code.
Modify the SELECT statement to work with the new name. Run the SQL and verify the result table is unchanged.
Modify the SELECT statement to perform a left join. Run the SQL and verify the result table includes songs with NULL genre.
Modify the SELECT statement to perform a right join. Run the SQL and verify the result table includes genres that are not associated with any songs.
Modify the SELECT statement to perform a cross join. Run the SQL and verify the result table includes all combinations of songs and genres.
Hint: Use keywords LEFT, RIGHT, and CROSS. Other join keywords, such as INNER, OUTER, or FULL have non-standard syntax or behavior in MySQL.
Other modifications to try: Perform a left join and a right join.
CREATE TABLE genre (
code CHAR(3),
name VARCHAR(20),
description VARCHAR(200),
PRIMARY KEY (code)
);
CREATE TABLE song (
song_id INT,
title VARCHAR(60),
artist VARCHAR(60),
genre_code CHAR(3),
PRIMARY KEY (song_id),
FOREIGN KEY (genre_code) REFERENCES genre(code)
);
INSERT INTO genre VALUES
('CLA', 'Classical', 'Orchestral music composed and performed by professionally trained artists'),
('COU', 'Country', 'Developed mostly in southern USA, with roots in traditional folk music, spirituals and blues'),
('DRO', 'Drone', 'Minimalist music that emphasizes sustained or repeated sounds, notes, or tone clusters'),
('GRU', 'Grunge', 'Alternative rock inspired by hardcore punk, heavy metal, and indie rock'),
('PRC', 'Pop Rock', 'Rock music with less attitude'),
('RAB', 'R&B', 'Modern version of soul and funk African-American pop music'),
('TEC', 'Techno', 'Electronic music');
INSERT INTO song VALUES
(100, 'Hey Jude', 'Beatles', 'PRC'),
(200, 'You Belong With Me', 'Taylor Swift', NULL),
(300, 'Need You Now', 'Lady Antebellum', 'COU'),
(400, 'Old Town Road', 'Lil Nas X', NULL),
(500, 'That\'s The Way Love Goes', 'Janet Jackson', 'RAB'),
(600, 'Even Flow', 'Pearl Jam', 'GRU');
SELECT *
FROM song
INNER JOIN genre
ON genre_code = code;

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 05:10
Suppose we have a byte addressable computer that has a 32-byte cache with 8 bytes per block. the memory address is 8 bits long. the system accesses memory addresses (in hex) in this exact order: 6e, b9, 17, e0, 4e, 4f, 50, 91, a8, ab, ad, 93, and 94. (a) assuming the cache is direct mapped, what memory addresses will be in cache block 2 after the last address has been accessed? (b) assuming the cache is direct mapped, what is the hit ratio for the entire memory reference sequence given, assuming the cache is initially empty? (c) assuming the cache is 2-way set associative with a lru replacement policy, what is the hit ratio?
Answers: 3
question
Computers and Technology, 23.06.2019 14:30
Norder to receive financial aid at his vocational school, mario must fill out the fafsa. the fafsa is a form that must be completed to determine . in order to complete a fafsa, you must submit . the fafsa can students obtain
Answers: 2
question
Computers and Technology, 23.06.2019 15:00
What is the total resistance in a circuit that contains three 60 ohm resistors connected in a series? a. 20 ohms b. 120 ohms c. 60 ohms d. 180 ohms
Answers: 2
question
Computers and Technology, 23.06.2019 15:00
Idon’t understand the double8 coding problem. it is java
Answers: 1
You know the right answer?
The SQL below creates Genre and Song tables, inserts some genres and songs, and performs an inner jo...
Questions
question
Mathematics, 02.05.2021 03:50
question
Mathematics, 02.05.2021 03:50
question
Chemistry, 02.05.2021 03:50
question
English, 02.05.2021 03:50
question
History, 02.05.2021 03:50
question
History, 02.05.2021 03:50
Questions on the website: 13722367