lianghsun/spider-text2sql-bench huggingface dataset:
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
how many programs are there?

### SQL
SELECT count(*) FROM program
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
Count the number of programs.

### SQL
SELECT count(*) FROM program
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
list all the names of programs, ordering by launch time.

### SQL
SELECT name FROM program ORDER BY launch
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
What is the list of program names, sorted by the order of launch date?

### SQL
SELECT name FROM program ORDER BY launch
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
List the name, origin and owner of each program.

### SQL
SELECT name ,  origin ,  OWNER FROM program
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
What are the name, origin and owner of each program?

### SQL
SELECT name ,  origin ,  OWNER FROM program
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
find the name of the program that was launched most recently.

### SQL
SELECT name FROM program ORDER BY launch DESC LIMIT 1
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
Which program was launched most recently? Return the program name.

### SQL
SELECT name FROM program ORDER BY launch DESC LIMIT 1
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
find the total percentage share of all channels owned by CCTV.

### SQL
SELECT sum(Share_in_percent) FROM channel WHERE OWNER  =  'CCTV'
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
What is the total share (in percent) of all the channels owned by CCTV?

### SQL
SELECT sum(Share_in_percent) FROM channel WHERE OWNER  =  'CCTV'
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### 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'
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
Which channels are broadcast in the morning? Give me the channel names.

### 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'
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### 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'
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
Which channels broadcast both in the morning and at night? Give me the channel names.

### 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'
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
how many programs are broadcast in each time section of the day?

### SQL
SELECT count(*) ,  time_of_day FROM broadcast GROUP BY time_of_day
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
Count the number of programs broadcast for each time section of a day.

### SQL
SELECT count(*) ,  time_of_day FROM broadcast GROUP BY time_of_day
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
find the number of different programs that are broadcast during night time.

### SQL
SELECT count(DISTINCT program_id) FROM broadcast WHERE time_of_day  =  'Night'
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
How many distinct programs are broadcast at "Night" time?

### SQL
SELECT count(DISTINCT program_id) FROM broadcast WHERE time_of_day  =  'Night'
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### 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"
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
Which programs are never broadcasted in the morning? Give me the names of the programs.

### 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"
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### 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"
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
Who are the owners of the programs that broadcast both in the morning and at night?

### 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"
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
List all program origins in the alphabetical order.

### SQL
SELECT origin FROM program ORDER BY origin
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
What is the list of program origins ordered alphabetically?

### SQL
SELECT origin FROM program ORDER BY origin
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
what is the number of different channel owners?

### SQL
SELECT count(DISTINCT OWNER) FROM channel
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
Count the number of distinct channel owners.

### SQL
SELECT count(DISTINCT OWNER) FROM channel
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
find the names of programs whose origin is not in Beijing.

### SQL
SELECT name FROM program WHERE origin != 'Beijing'
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
Which programs' origins are not "Beijing"? Give me the program names.

### SQL
SELECT name FROM program WHERE origin != 'Beijing'
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
What are the names of the channels owned by CCTV or HBS?

### SQL
SELECT name FROM channel WHERE OWNER  =  'CCTV' OR OWNER  =  'HBS'
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
List the names of all the channels owned by either CCTV or HBS

### SQL
SELECT name FROM channel WHERE OWNER  =  'CCTV' OR OWNER  =  'HBS'
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
Find the total rating ratio for each channel owner.

### SQL
SELECT sum(Rating_in_percent) ,  OWNER FROM channel GROUP BY OWNER
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
What is the total rating of channel for each channel owner?

### SQL
SELECT sum(Rating_in_percent) ,  OWNER FROM channel GROUP BY OWNER
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
Find the name of the program that is broadcast most frequently.

### SQL
SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id  =  t2.program_id GROUP BY t2.program_id ORDER BY count(*) DESC LIMIT 1
### Database Schema
CREATE TABLE "program" (
"Program_ID" int,
"Name" text,
"Origin" text,
"Launch" real,
"Owner" text,
PRIMARY KEY ("Program_ID")
)

CREATE TABLE "channel" (
"Channel_ID" int,
"Name" text,
"Owner" text,
"Share_in_percent" real,
"Rating_in_percent" real,
PRIMARY KEY ("Channel_ID")
)

CREATE TABLE "broadcast" (
"Channel_ID" int,
"Program_ID" int,
"Time_of_day" text,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

CREATE TABLE "broadcast_share" (
"Channel_ID" int,
"Program_ID" int,
"Date" text,
"Share_in_percent" real,
PRIMARY KEY ("Channel_ID","Program_ID"),
FOREIGN KEY (`Channel_ID`) REFERENCES `channel`(`Channel_ID`),
FOREIGN KEY (`Program_ID`) REFERENCES `program`(`Program_ID`)
)

### Question
Which program is broadcast most frequently? Give me the program name.

### SQL
SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id  =  t2.program_id GROUP BY t2.program_id ORDER BY count(*) DESC LIMIT 1
### Database Schema
CREATE TABLE `Course_Authors_and_Tutors` (
`author_id` INTEGER PRIMARY KEY,
`author_tutor_ATB` VARCHAR(3),
`login_name` VARCHAR(40),
`password` VARCHAR(40),
`personal_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`family_name` VARCHAR(80),
`gender_mf` VARCHAR(1),
`address_line_1` VARCHAR(80)
)

CREATE TABLE `Students` (
`student_id` INTEGER PRIMARY KEY,
`date_of_registration` DATETIME,
`date_of_latest_logon` DATETIME,
`login_name` VARCHAR(40),
`password` VARCHAR(10),
`personal_name` VARCHAR(40),
`middle_name` VARCHAR(40),
`family_name` VARCHAR(40)
)

CREATE TABLE `Subjects` (
`subject_id` INTEGER PRIMARY KEY,
`subject_name` VARCHAR(120)
)

CREATE TABLE `Courses` (
`course_id` INTEGER PRIMARY KEY,
`author_id` INTEGER NOT NULL,
`subject_id` INTEGER NOT NULL,
`course_name` VARCHAR(120),
`course_description` VARCHAR(255),
FOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),
FOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )
)

CREATE TABLE `Student_Course_Enrolment` (
`registration_id` INTEGER PRIMARY KEY,
`student_id` INTEGER NOT NULL,
`course_id` INTEGER NOT NULL,
`date_of_enrolment` DATETIME NOT NULL,
`date_of_completion` DATETIME NOT NULL,
FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),
FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )
)

CREATE TABLE `Student_Tests_Taken` (
`registration_id` INTEGER NOT NULL,
`date_test_taken` DATETIME NOT NULL,
`test_result` VARCHAR(255),
FOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )
)

### Question
How many courses are there in total?

### SQL
SELECT count(*) FROM COURSES
### Database Schema
CREATE TABLE `Course_Authors_and_Tutors` (
`author_id` INTEGER PRIMARY KEY,
`author_tutor_ATB` VARCHAR(3),
`login_name` VARCHAR(40),
`password` VARCHAR(40),
`personal_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`family_name` VARCHAR(80),
`gender_mf` VARCHAR(1),
`address_line_1` VARCHAR(80)
)

CREATE TABLE `Students` (
`student_id` INTEGER PRIMARY KEY,
`date_of_registration` DATETIME,
`date_of_latest_logon` DATETIME,
`login_name` VARCHAR(40),
`password` VARCHAR(10),
`personal_name` VARCHAR(40),
`middle_name` VARCHAR(40),
`family_name` VARCHAR(40)
)

CREATE TABLE `Subjects` (
`subject_id` INTEGER PRIMARY KEY,
`subject_name` VARCHAR(120)
)

CREATE TABLE `Courses` (
`course_id` INTEGER PRIMARY KEY,
`author_id` INTEGER NOT NULL,
`subject_id` INTEGER NOT NULL,
`course_name` VARCHAR(120),
`course_description` VARCHAR(255),
FOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),
FOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )
)

CREATE TABLE `Student_Course_Enrolment` (
`registration_id` INTEGER PRIMARY KEY,
`student_id` INTEGER NOT NULL,
`course_id` INTEGER NOT NULL,
`date_of_enrolment` DATETIME NOT NULL,
`date_of_completion` DATETIME NOT NULL,
FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),
FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )
)

CREATE TABLE `Student_Tests_Taken` (
`registration_id` INTEGER NOT NULL,
`date_test_taken` DATETIME NOT NULL,
`test_result` VARCHAR(255),
FOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )
)

### Question
Find the total number of courses offered.

### SQL
SELECT count(*) FROM COURSES
### Database Schema
CREATE TABLE `Course_Authors_and_Tutors` (
`author_id` INTEGER PRIMARY KEY,
`author_tutor_ATB` VARCHAR(3),
`login_name` VARCHAR(40),
`password` VARCHAR(40),
`personal_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`family_name` VARCHAR(80),
`gender_mf` VARCHAR(1),
`address_line_1` VARCHAR(80)
)

CREATE TABLE `Students` (
`student_id` INTEGER PRIMARY KEY,
`date_of_registration` DATETIME,
`date_of_latest_logon` DATETIME,
`login_name` VARCHAR(40),
`password` VARCHAR(10),
`personal_name` VARCHAR(40),
`middle_name` VARCHAR(40),
`family_name` VARCHAR(40)
)

CREATE TABLE `Subjects` (
`subject_id` INTEGER PRIMARY KEY,
`subject_name` VARCHAR(120)
)

CREATE TABLE `Courses` (
`course_id` INTEGER PRIMARY KEY,
`author_id` INTEGER NOT NULL,
`subject_id` INTEGER NOT NULL,
`course_name` VARCHAR(120),
`course_description` VARCHAR(255),
FOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),
FOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )
)

CREATE TABLE `Student_Course_Enrolment` (
`registration_id` INTEGER PRIMARY KEY,
`student_id` INTEGER NOT NULL,
`course_id` INTEGER NOT NULL,
`date_of_enrolment` DATETIME NOT NULL,
`date_of_completion` DATETIME NOT NULL,
FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),
FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )
)

CREATE TABLE `Student_Tests_Taken` (
`registration_id` INTEGER NOT NULL,
`date_test_taken` DATETIME NOT NULL,
`test_result` VARCHAR(255),
FOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )
)

### Question
What are the descriptions of the courses with name "database"?

### SQL
SELECT course_description FROM COURSES WHERE course_name  =  "database"
### Database Schema
CREATE TABLE `Course_Authors_and_Tutors` (
`author_id` INTEGER PRIMARY KEY,
`author_tutor_ATB` VARCHAR(3),
`login_name` VARCHAR(40),
`password` VARCHAR(40),
`personal_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`family_name` VARCHAR(80),
`gender_mf` VARCHAR(1),
`address_line_1` VARCHAR(80)
)

CREATE TABLE `Students` (
`student_id` INTEGER PRIMARY KEY,
`date_of_registration` DATETIME,
`date_of_latest_logon` DATETIME,
`login_name` VARCHAR(40),
`password` VARCHAR(10),
`personal_name` VARCHAR(40),
`middle_name` VARCHAR(40),
`family_name` VARCHAR(40)
)

CREATE TABLE `Subjects` (
`subject_id` INTEGER PRIMARY KEY,
`subject_name` VARCHAR(120)
)

CREATE TABLE `Courses` (
`course_id` INTEGER PRIMARY KEY,
`author_id` INTEGER NOT NULL,
`subject_id` INTEGER NOT NULL,
`course_name` VARCHAR(120),
`course_description` VARCHAR(255),
FOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),
FOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )
)

CREATE TABLE `Student_Course_Enrolment` (
`registration_id` INTEGER PRIMARY KEY,
`student_id` INTEGER NOT NULL,
`course_id` INTEGER NOT NULL,
`date_of_enrolment` DATETIME NOT NULL,
`date_of_completion` DATETIME NOT NULL,
FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),
FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )
)

CREATE TABLE `Student_Tests_Taken` (
`registration_id` INTEGER NOT NULL,
`date_test_taken` DATETIME NOT NULL,
`test_result` VARCHAR(255),
FOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )
)

### Question
Return the description for the courses named "database".

### SQL
SELECT course_description FROM COURSES WHERE course_name  =  "database"
### Database Schema
CREATE TABLE `Course_Authors_and_Tutors` (
`author_id` INTEGER PRIMARY KEY,
`author_tutor_ATB` VARCHAR(3),
`login_name` VARCHAR(40),
`password` VARCHAR(40),
`personal_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`family_name` VARCHAR(80),
`gender_mf` VARCHAR(1),
`address_line_1` VARCHAR(80)
)

CREATE TABLE `Students` (
`student_id` INTEGER PRIMARY KEY,
`date_of_registration` DATETIME,
`date_of_latest_logon` DATETIME,
`login_name` VARCHAR(40),
`password` VARCHAR(10),
`personal_name` VARCHAR(40),
`middle_name` VARCHAR(40),
`family_name` VARCHAR(40)
)

CREATE TABLE `Subjects` (
`subject_id` INTEGER PRIMARY KEY,
`subject_name` VARCHAR(120)
)

CREATE TABLE `Courses` (
`course_id` INTEGER PRIMARY KEY,
`author_id` INTEGER NOT NULL,
`subject_id` INTEGER NOT NULL,
`course_name` VARCHAR(120),
`course_description` VARCHAR(255),
FOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),
FOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )
)

CREATE TABLE `Student_Course_Enrolment` (
`registration_id` INTEGER PRIMARY KEY,
`student_id` INTEGER NOT NULL,
`course_id` INTEGER NOT NULL,
`date_of_enrolment` DATETIME NOT NULL,
`date_of_completion` DATETIME NOT NULL,
FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),
FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )
)

CREATE TABLE `Student_Tests_Taken` (
`registration_id` INTEGER NOT NULL,
`date_test_taken` DATETIME NOT NULL,
`test_result` VARCHAR(255),
FOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )
)

### Question
What are the addresses of the course authors or tutors with personal name "Cathrine"

### SQL
SELECT address_line_1 FROM Course_Authors_and_Tutors WHERE personal_name	 =  "Cathrine"
### Database Schema
CREATE TABLE `Course_Authors_and_Tutors` (
`author_id` INTEGER PRIMARY KEY,
`author_tutor_ATB` VARCHAR(3),
`login_name` VARCHAR(40),
`password` VARCHAR(40),
`personal_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`family_name` VARCHAR(80),
`gender_mf` VARCHAR(1),
`address_line_1` VARCHAR(80)
)

CREATE TABLE `Students` (
`student_id` INTEGER PRIMARY KEY,
`date_of_registration` DATETIME,
`date_of_latest_logon` DATETIME,
`login_name` VARCHAR(40),
`password` VARCHAR(10),
`personal_name` VARCHAR(40),
`middle_name` VARCHAR(40),
`family_name` VARCHAR(40)
)

CREATE TABLE `Subjects` (
`subject_id` INTEGER PRIMARY KEY,
`subject_name` VARCHAR(120)
)

CREATE TABLE `Courses` (
`course_id` INTEGER PRIMARY KEY,
`author_id` INTEGER NOT NULL,
`subject_id` INTEGER NOT NULL,
`course_name` VARCHAR(120),
`course_description` VARCHAR(255),
FOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),
FOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )
)

CREATE TABLE `Student_Course_Enrolment` (
`registration_id` INTEGER PRIMARY KEY,
`student_id` INTEGER NOT NULL,
`course_id` INTEGER NOT NULL,
`date_of_enrolment` DATETIME NOT NULL,
`date_of_completion` DATETIME NOT NULL,
FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),
FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )
)

CREATE TABLE `Student_Tests_Taken` (
`registration_id` INTEGER NOT NULL,
`date_test_taken` DATETIME NOT NULL,
`test_result` VARCHAR(255),
FOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )
)

### Question
Return the addresses of the course authors or tutors whose personal name is "Cathrine".

### SQL
SELECT address_line_1 FROM Course_Authors_and_Tutors WHERE personal_name	 =  "Cathrine"
### Database Schema
CREATE TABLE `Course_Authors_and_Tutors` (
`author_id` INTEGER PRIMARY KEY,
`author_tutor_ATB` VARCHAR(3),
`login_name` VARCHAR(40),
`password` VARCHAR(40),
`personal_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`family_name` VARCHAR(80),
`gender_mf` VARCHAR(1),
`address_line_1` VARCHAR(80)
)

CREATE TABLE `Students` (
`student_id` INTEGER PRIMARY KEY,
`date_of_registration` DATETIME,
`date_of_latest_logon` DATETIME,
`login_name` VARCHAR(40),
`password` VARCHAR(10),
`personal_name` VARCHAR(40),
`middle_name` VARCHAR(40),
`family_name` VARCHAR(40)
)

CREATE TABLE `Subjects` (
`subject_id` INTEGER PRIMARY KEY,
`subject_name` VARCHAR(120)
)

CREATE TABLE `Courses` (
`course_id` INTEGER PRIMARY KEY,
`author_id` INTEGER NOT NULL,
`subject_id` INTEGER NOT NULL,
`course_name` VARCHAR(120),
`course_description` VARCHAR(255),
FOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),
FOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )
)

CREATE TABLE `Student_Course_Enrolment` (
`registration_id` INTEGER PRIMARY KEY,
`student_id` INTEGER NOT NULL,
`course_id` INTEGER NOT NULL,
`date_of_enrolment` DATETIME NOT NULL,
`date_of_completion` DATETIME NOT NULL,
FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),
FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )
)

CREATE TABLE `Student_Tests_Taken` (
`registration_id` INTEGER NOT NULL,
`date_test_taken` DATETIME NOT NULL,
`test_result` VARCHAR(255),
FOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )
)

### Question
List the addresses of all the course authors or tutors.

### SQL
SELECT address_line_1 FROM Course_Authors_and_Tutors
### Database Schema
CREATE TABLE `Course_Authors_and_Tutors` (
`author_id` INTEGER PRIMARY KEY,
`author_tutor_ATB` VARCHAR(3),
`login_name` VARCHAR(40),
`password` VARCHAR(40),
`personal_name` VARCHAR(80),
`middle_name` VARCHAR(80),
`family_name` VARCHAR(80),
`gender_mf` VARCHAR(1),
`address_line_1` VARCHAR(80)
)

CREATE TABLE `Students` (
`student_id` INTEGER PRIMARY KEY,
`date_of_registration` DATETIME,
`date_of_latest_logon` DATETIME,
`login_name` VARCHAR(40),
`password` VARCHAR(10),
`personal_name` VARCHAR(40),
`middle_name` VARCHAR(40),
`family_name` VARCHAR(40)
)

CREATE TABLE `Subjects` (
`subject_id` INTEGER PRIMARY KEY,
`subject_name` VARCHAR(120)
)

CREATE TABLE `Courses` (
`course_id` INTEGER PRIMARY KEY,
`author_id` INTEGER NOT NULL,
`subject_id` INTEGER NOT NULL,
`course_name` VARCHAR(120),
`course_description` VARCHAR(255),
FOREIGN KEY (`author_id` ) REFERENCES `Course_Authors_and_Tutors`(`author_id` ),
FOREIGN KEY (`subject_id` ) REFERENCES `Subjects`(`subject_id` )
)

CREATE TABLE `Student_Course_Enrolment` (
`registration_id` INTEGER PRIMARY KEY,
`student_id` INTEGER NOT NULL,
`course_id` INTEGER NOT NULL,
`date_of_enrolment` DATETIME NOT NULL,
`date_of_completion` DATETIME NOT NULL,
FOREIGN KEY (`course_id` ) REFERENCES `Courses`(`course_id` ),
FOREIGN KEY (`student_id` ) REFERENCES `Students`(`student_id` )
)

CREATE TABLE `Student_Tests_Taken` (
`registration_id` INTEGER NOT NULL,
`date_test_taken` DATETIME NOT NULL,
`test_result` VARCHAR(255),
FOREIGN KEY (`registration_id` ) REFERENCES `Student_Course_Enrolment`(`registration_id` )
)

### Question
What is the address of each course author or tutor?

### SQL
SELECT address_line_1 FROM Course_Authors_and_Tutors