human
Schema:
program (Program_ID, Name, Origin, Launch, Owner)
channel (Channel_ID, Name, Owner, Share_in_percent, Rating_in_percent)
broadcast (Channel_ID, Program_ID, Time_of_day)
broadcast_share (Channel_ID, Program_ID, Date, Share_in_percent)
Please answer with SQL.
assistant
Sure, I understand.
human
List all program origins in the alphabetical order.
assistant
SELECT origin FROM program ORDER BY origin
human
find the name of the program that was launched most recently.
assistant
SELECT name FROM program ORDER BY launch DESC LIMIT 1
human
list all the names of programs, ordering by launch time.
assistant
SELECT name FROM program ORDER BY launch
human
List the name, origin and owner of each program.
assistant
SELECT name , origin , OWNER FROM program
human
find the number of different programs that are broadcast during night time.
assistant
SELECT count(DISTINCT program_id) FROM broadcast WHERE time_of_day = 'Night'
human
Count the number of programs.
assistant
SELECT COUNT( * ) FROM program ;