Database: program_share

Question: What is the owner of the channel that has the highest rating ratio?
SQL: SELECT OWNER FROM channel ORDER BY rating_in_percent DESC LIMIT 1

Question: find the name of the program that was launched most recently.
SQL: SELECT name FROM program ORDER BY launch DESC LIMIT 1

Question: Find the names of the channels that are broadcast in the morning.
SQL: SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id  =  t2.channel_id WHERE t2.time_of_day  =  'Morning'

Question: what are the names of the channels that broadcast in both morning and night?
SQL: SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id  =  t2.channel_id WHERE t2.time_of_day  =  'Morning' INTERSECT SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id  =  t2.channel_id WHERE t2.time_of_day  =  'Night'

Question: Find the names of programs that are never broadcasted in the morning.
SQL: SELECT name FROM program EXCEPT SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id  =  t2.program_id WHERE t2.Time_of_day  =  "Morning"

Question: find the program owners that have some programs in both morning and night time.
SQL: SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id  =  t2.program_id WHERE t2.Time_of_day  =  "Morning" INTERSECT SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id  =  t2.program_id WHERE t2.Time_of_day  =  "Night"

Question: What are the names of the channels owned by CCTV or HBS?
SQL: SELECT name FROM channel WHERE OWNER  =  'CCTV' OR OWNER  =  'HBS'