db_id
stringclasses
146 values
question
stringlengths
3
224
sql
stringlengths
18
577
database_schema
stringclasses
146 values
soccer_2
Find the name of all students who were in the tryout sorted in alphabetic order.
SELECT T1.pName FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID ORDER BY T1.pName
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What are the names of all students who tried out in alphabetical order?
SELECT T1.pName FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID ORDER BY T1.pName
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
Find the name and hours of the students whose tryout decision is yes.
SELECT T1.pName , T1.HS FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What are the names and hours spent practicing of every student who received a yes at tryouts?
SELECT T1.pName , T1.HS FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
Find the states of the colleges that have students in the tryout who played in striker position.
SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'striker'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What are the states of the colleges where students who tried out for the striker position attend?
SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'striker'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
Find the names of the students who are in the position of striker and got a yes tryout decision.
SELECT T1.pName FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes' AND T2.pPos = 'striker'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What are the names of all students who successfully tried out for the position of striker?
SELECT T1.pName FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes' AND T2.pPos = 'striker'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
Find the state of the college which player Charles is attending.
SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName JOIN player AS T3 ON T2.pID = T3.pID WHERE T3.pName = 'Charles'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
In which state is the college that Charles attends?
SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName JOIN player AS T3 ON T2.pID = T3.pID WHERE T3.pName = 'Charles'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
Find the average and maximum hours for the students whose tryout decision is yes.
SELECT avg(T1.HS) , max(T1.HS) FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What is the average and maximum number of hours students who made the team practiced?
SELECT avg(T1.HS) , max(T1.HS) FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'yes'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
Find the average hours for the students whose tryout decision is no.
SELECT avg(T1.HS) FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'no'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What is the average number of hours spent practicing for students who got rejected?
SELECT avg(T1.HS) FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T2.decision = 'no'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What is the maximum training hours for the students whose training hours is greater than 1000 in different positions?
SELECT max(T1.HS) , pPos FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T1.HS > 1000 GROUP BY T2.pPos
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
For each position, what is the maximum number of hours for students who spent more than 1000 hours training?
SELECT max(T1.HS) , pPos FROM player AS T1 JOIN tryout AS T2 ON T1.pID = T2.pID WHERE T1.HS > 1000 GROUP BY T2.pPos
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
Which colleges do the tryout players whose name starts with letter D go to?
SELECT T1.cName FROM tryout AS T1 JOIN player AS T2 ON T1.pID = T2.pID WHERE T2.pName LIKE 'D%'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
Which colleges does each player with a name that starts with the letter D who tried out go to?
SELECT T1.cName FROM tryout AS T1 JOIN player AS T2 ON T1.pID = T2.pID WHERE T2.pName LIKE 'D%'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
Which college has any student who is a goalie and succeeded in the tryout.
SELECT cName FROM tryout WHERE decision = 'yes' AND pPos = 'goalie'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What college has a student who successfully made the team in the role of a goalie?
SELECT cName FROM tryout WHERE decision = 'yes' AND pPos = 'goalie'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
Find the name of the tryout players who are from the college with largest size.
SELECT T2.pName FROM tryout AS T1 JOIN player AS T2 ON T1.pID = T2.pID WHERE T1.cName = (SELECT cName FROM college ORDER BY enr DESC LIMIT 1)
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What are the names of all tryout participants who are from the largest college?
SELECT T2.pName FROM tryout AS T1 JOIN player AS T2 ON T1.pID = T2.pID WHERE T1.cName = (SELECT cName FROM college ORDER BY enr DESC LIMIT 1)
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What is the state and enrollment of the colleges where have any students who got accepted in the tryout decision.
SELECT DISTINCT T1.state , T1.enr FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.decision = 'yes'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
How many students are enrolled in colleges that have student accepted during tryouts, and in which states are those colleges?
SELECT DISTINCT T1.state , T1.enr FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.decision = 'yes'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
Find the names of either colleges in LA with greater than 15000 size or in state AZ with less than 13000 enrollment.
SELECT cName FROM College WHERE enr < 13000 AND state = "AZ" UNION SELECT cName FROM College WHERE enr > 15000 AND state = "LA"
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What are the names of colleges in LA that have more than 15,000 students and of colleges in AZ with less than 13,000 students?
SELECT cName FROM College WHERE enr < 13000 AND state = "AZ" UNION SELECT cName FROM College WHERE enr > 15000 AND state = "LA"
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
Find the names of schools that have some students playing in goalie and mid positions.
SELECT cName FROM tryout WHERE pPos = 'goalie' INTERSECT SELECT cName FROM tryout WHERE pPos = 'mid'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What are the names of all schools that have students trying out for the position of goal and 'mid'-field.
SELECT cName FROM tryout WHERE pPos = 'goalie' INTERSECT SELECT cName FROM tryout WHERE pPos = 'mid'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
Find the names of states that have some college students playing in goalie and mid positions.
SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'goalie' INTERSECT SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'mid'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What are the names of the states that have some college students playing in the positions of goalie and mid-field?
SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'goalie' INTERSECT SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'mid'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
How many schools have some students playing in goalie and mid positions.
SELECT COUNT(*) FROM (SELECT cName FROM tryout WHERE pPos = 'goalie' INTERSECT SELECT cName FROM tryout WHERE pPos = 'mid')
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
How many schools have students playing in goalie and mid-field positions?
SELECT COUNT(*) FROM (SELECT cName FROM tryout WHERE pPos = 'goalie' INTERSECT SELECT cName FROM tryout WHERE pPos = 'mid')
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
Find the names of schools that have some players in the mid position but not in the goalie position.
SELECT cName FROM tryout WHERE pPos = 'mid' EXCEPT SELECT cName FROM tryout WHERE pPos = 'goalie'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What are the names of the schools with some players in the mid position but no goalies?
SELECT cName FROM tryout WHERE pPos = 'mid' EXCEPT SELECT cName FROM tryout WHERE pPos = 'goalie'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
Find the names of states that have some college students playing in the mid position but not in the goalie position.
SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'mid' EXCEPT SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'goalie'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What are the names of all the states with college students playing in the mid position but no goalies?
SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'mid' EXCEPT SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'goalie'
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
How many states that have some college students playing in the mid position but not in the goalie position.
SELECT COUNT(*) FROM (SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'mid' EXCEPT SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'goalie')
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What is the count of states with college students playing in the mid position but not as goalies?
SELECT COUNT(*) FROM (SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'mid' EXCEPT SELECT T1.state FROM college AS T1 JOIN tryout AS T2 ON T1.cName = T2.cName WHERE T2.pPos = 'goalie')
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
Find the states where have the colleges whose enrollments are less than the largest size.
SELECT DISTINCT state FROM college WHERE enr < (SELECT max(enr) FROM college)
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What are the states with colleges that have enrollments less than the some other college?
SELECT DISTINCT state FROM college WHERE enr < (SELECT max(enr) FROM college)
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
Find names of colleges with enrollment greater than that of some (at least one) college in the FL state.
SELECT DISTINCT cName FROM college WHERE enr > (SELECT min(enr) FROM college WHERE state = 'FL')
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What are the names of the colleges that are larger than at least one college in Florida?
SELECT DISTINCT cName FROM college WHERE enr > (SELECT min(enr) FROM college WHERE state = 'FL')
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
Find names of all colleges whose enrollment is greater than that of all colleges in the FL state.
SELECT cName FROM college WHERE enr > (SELECT max(enr) FROM college WHERE state = 'FL')
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What are the names of all colleges with a larger enrollment than the largest college in Florida?
SELECT cName FROM college WHERE enr > (SELECT max(enr) FROM college WHERE state = 'FL')
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What is the total number of enrollment of schools that do not have any goalie player?
SELECT sum(enr) FROM college WHERE cName NOT IN (SELECT cName FROM tryout WHERE pPos = "goalie")
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What is the total number of students enrolled in schools without any goalies?
SELECT sum(enr) FROM college WHERE cName NOT IN (SELECT cName FROM tryout WHERE pPos = "goalie")
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What is the number of states that has some college whose enrollment is larger than the average enrollment?
SELECT count(DISTINCT state) FROM college WHERE enr > (SELECT avg(enr) FROM college)
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
How many states have a college with more students than average?
SELECT count(DISTINCT state) FROM college WHERE enr > (SELECT avg(enr) FROM college)
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
What is the number of states that has some colleges whose enrollment is smaller than the average enrollment?
SELECT count(DISTINCT state) FROM college WHERE enr < (SELECT avg(enr) FROM college)
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
soccer_2
How many states have smaller colleges than average?
SELECT count(DISTINCT state) FROM college WHERE enr < (SELECT avg(enr) FROM college)
CREATE TABLE College ( cName varchar(20) NOT NULL, state varchar(2), enr numeric(5,0), PRIMARY KEY (cName) ) 3 rows from College table: cName state enr LSU LA 18000 ASU AZ 12000 OU OK 22000 CREATE TABLE Player ( pID numeric(5,0) NOT NULL, pName varchar(20), yCard varchar(3), HS numeric(5,0), PRIMARY KEY (pID) ) 3 rows from Player table: pID pName yCard HS 10001 Andrew no 1200 20002 Blake no 1600 30003 Charles no 300 CREATE TABLE Tryout ( pID numeric(5,0), cName varchar(20), pPos varchar(8), decision varchar(3), PRIMARY KEY (pID, cName), FOREIGN KEY (pID) REFERENCES Player(pID), FOREIGN KEY (cName) REFERENCES College(cName) ) 3 rows from Tryout table: pID cName pPos decision 10001 LSU goalie no 10001 ASU goalie yes 20002 FSU striker yes
device
How many devices are there?
SELECT count(*) FROM device
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
Count the number of devices.
SELECT count(*) FROM device
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
List the carriers of devices in ascending alphabetical order.
SELECT Carrier FROM device ORDER BY Carrier ASC
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
What are the different carriers for devices, listed in alphabetical order?
SELECT Carrier FROM device ORDER BY Carrier ASC
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
What are the carriers of devices whose software platforms are not "Android"?
SELECT Carrier FROM device WHERE Software_Platform != 'Android'
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
Return the device carriers that do not have Android as their software platform.
SELECT Carrier FROM device WHERE Software_Platform != 'Android'
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
What are the names of shops in ascending order of open year?
SELECT Shop_Name FROM shop ORDER BY Open_Year ASC
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
Return the names of shops, ordered by year of opening ascending.
SELECT Shop_Name FROM shop ORDER BY Open_Year ASC
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
What is the average quantity of stocks?
SELECT avg(Quantity) FROM stock
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
Give the average quantity of stocks.
SELECT avg(Quantity) FROM stock
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
What are the names and location of the shops in ascending alphabetical order of name.
SELECT Shop_Name , LOCATION FROM shop ORDER BY Shop_Name ASC
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
Return the names and locations of shops, ordered by name in alphabetical order.
SELECT Shop_Name , LOCATION FROM shop ORDER BY Shop_Name ASC
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
How many different software platforms are there for devices?
SELECT count(DISTINCT Software_Platform) FROM device
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
Count the number of different software platforms.
SELECT count(DISTINCT Software_Platform) FROM device
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
List the open date of open year of the shop named "Apple".
SELECT Open_Date , Open_Year FROM shop WHERE Shop_Name = "Apple"
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
What are the open dates and years for the shop named Apple?
SELECT Open_Date , Open_Year FROM shop WHERE Shop_Name = "Apple"
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
List the name of the shop with the latest open year.
SELECT Shop_Name FROM shop ORDER BY Open_Year DESC LIMIT 1
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
What is the shop name corresponding to the shop that opened in the most recent year?
SELECT Shop_Name FROM shop ORDER BY Open_Year DESC LIMIT 1
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
Show names of shops and the carriers of devices they have in stock.
SELECT T3.Shop_Name , T2.Carrier FROM stock AS T1 JOIN device AS T2 ON T1.Device_ID = T2.Device_ID JOIN shop AS T3 ON T1.Shop_ID = T3.Shop_ID
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
What are the names of device shops, and what are the carriers that they carry devices in stock for?
SELECT T3.Shop_Name , T2.Carrier FROM stock AS T1 JOIN device AS T2 ON T1.Device_ID = T2.Device_ID JOIN shop AS T3 ON T1.Shop_ID = T3.Shop_ID
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
Show names of shops that have more than one kind of device in stock.
SELECT T2.Shop_Name FROM stock AS T1 JOIN shop AS T2 ON T1.Shop_ID = T2.Shop_ID GROUP BY T1.Shop_ID HAVING COUNT(*) > 1
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
What are the names of shops that have more than a single kind of device in stock?
SELECT T2.Shop_Name FROM stock AS T1 JOIN shop AS T2 ON T1.Shop_ID = T2.Shop_ID GROUP BY T1.Shop_ID HAVING COUNT(*) > 1
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
Show the name of the shop that has the most kind of devices in stock.
SELECT T2.Shop_Name FROM stock AS T1 JOIN shop AS T2 ON T1.Shop_ID = T2.Shop_ID GROUP BY T1.Shop_ID ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
What is the name of the shop that has the most different kinds of devices in stock?
SELECT T2.Shop_Name FROM stock AS T1 JOIN shop AS T2 ON T1.Shop_ID = T2.Shop_ID GROUP BY T1.Shop_ID ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
Show the name of the shop that have the largest quantity of devices in stock.
SELECT T2.Shop_Name FROM stock AS T1 JOIN shop AS T2 ON T1.Shop_ID = T2.Shop_ID GROUP BY T1.Shop_ID ORDER BY SUM(T1.quantity) DESC LIMIT 1
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
What is the name of the shop that has the greatest quantity of devices in stock?
SELECT T2.Shop_Name FROM stock AS T1 JOIN shop AS T2 ON T1.Shop_ID = T2.Shop_ID GROUP BY T1.Shop_ID ORDER BY SUM(T1.quantity) DESC LIMIT 1
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
Please show different software platforms and the corresponding number of devices using each.
SELECT Software_Platform , COUNT(*) FROM device GROUP BY Software_Platform
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
What are the different software platforms for devices, and how many devices have each?
SELECT Software_Platform , COUNT(*) FROM device GROUP BY Software_Platform
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
Please show the software platforms of devices in descending order of the count.
SELECT Software_Platform FROM device GROUP BY Software_Platform ORDER BY COUNT(*) DESC
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
What are the different software platforms for devices, ordered by frequency descending?
SELECT Software_Platform FROM device GROUP BY Software_Platform ORDER BY COUNT(*) DESC
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
List the software platform shared by the greatest number of devices.
SELECT Software_Platform FROM device GROUP BY Software_Platform ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
What is the software platform that is most common amongst all devices?
SELECT Software_Platform FROM device GROUP BY Software_Platform ORDER BY COUNT(*) DESC LIMIT 1
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
List the names of shops that have no devices in stock.
SELECT Shop_Name FROM shop WHERE Shop_ID NOT IN (SELECT Shop_ID FROM stock)
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
What are the names of shops that do not have any devices in stock?
SELECT Shop_Name FROM shop WHERE Shop_ID NOT IN (SELECT Shop_ID FROM stock)
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
Show the locations shared by shops with open year later than 2012 and shops with open year before 2008.
SELECT LOCATION FROM shop WHERE Open_Year > 2012 INTERSECT SELECT LOCATION FROM shop WHERE Open_Year < 2008
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
Which locations contains both shops that opened after the year 2012 and shops that opened before 2008?
SELECT LOCATION FROM shop WHERE Open_Year > 2012 INTERSECT SELECT LOCATION FROM shop WHERE Open_Year < 2008
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
List the carriers of devices that have no devices in stock.
SELECT Carrier FROM device WHERE Device_ID NOT IN (SELECT Device_ID FROM stock)
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
What are the carriers of devices that are not in stock anywhere?
SELECT Carrier FROM device WHERE Device_ID NOT IN (SELECT Device_ID FROM stock)
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
Show the carriers of devices in stock at more than one shop.
SELECT T2.Carrier FROM stock AS T1 JOIN device AS T2 ON T1.Device_ID = T2.Device_ID GROUP BY T1.Device_ID HAVING COUNT(*) > 1
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
device
What are the carriers of devices that are in stock in more than a single shop?
SELECT T2.Carrier FROM stock AS T1 JOIN device AS T2 ON T1.Device_ID = T2.Device_ID GROUP BY T1.Device_ID HAVING COUNT(*) > 1
CREATE TABLE "device" ( "Device_ID" int, "Device" text, "Carrier" text, "Package_Version" text, "Applications" text, "Software_Platform" text, PRIMARY KEY ("Device_ID") ) 3 rows from device table: Device_ID Device Carrier Package_Version Applications Software_Platform 1 BlackBerry Storm 9530 MTS Mobility 5.0.0.808 5.0.0.419 Android 2 Apple Verizon Wireless 5.0.0.328 5.0.0.328 iOS 3 Huawei Telus Mobility 5.0.0.419 5.0.0.419 Android CREATE TABLE "shop" ( "Shop_ID" int, "Shop_Name" text, "Location" text, "Open_Date" text, "Open_Year" int, PRIMARY KEY ("Shop_ID") ) 3 rows from shop table: Shop_ID Shop_Name Location Open_Date Open_Year 1 Dinas Device Dinas 1 January 2014 2 Best Buy Cymmer 15 July 2006 3 Ferndale Blaenllechau 8 November 2009 CREATE TABLE "stock" ( "Shop_ID" int, "Device_ID" int, "Quantity" int, PRIMARY KEY ("Shop_ID","Device_ID"), FOREIGN KEY (`Shop_ID`) REFERENCES `shop`(`Shop_ID`), FOREIGN KEY (`Device_ID`) REFERENCES `device`(`Device_ID`) ) 3 rows from stock table: Shop_ID Device_ID Quantity 1 6 100 2 6 110 3 6 134
cre_Drama_Workshop_Groups
How many bookings do we have?
SELECT count(*) FROM BOOKINGS
CREATE TABLE Ref_Payment_Methods ( payment_method_code CHAR(10) NOT NULL, payment_method_description VARCHAR(80), PRIMARY KEY (payment_method_code), UNIQUE (payment_method_code) ) 3 rows from Ref_Payment_Methods table: payment_method_code payment_method_description American E credit MasterCard debit Visa Visa CREATE TABLE Ref_Service_Types ( Service_Type_Code CHAR(15) NOT NULL, Parent_Service_Type_Code CHAR(15), Service_Type_Description VARCHAR(255), PRIMARY KEY (Service_Type_Code), UNIQUE (Service_Type_Code) ) 3 rows from Ref_Service_Types table: Service_Type_Code Parent_Service_Type_Code Service_Type_Description 1 1 provide photo service 2 1 provide dinning service 3 1 provide filming service CREATE TABLE Addresses ( Address_ID VARCHAR(100) NOT NULL, Line_1 VARCHAR(255), Line_2 VARCHAR(255), City_Town VARCHAR(255), State_County VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Address_ID), UNIQUE (Address_ID) ) 3 rows from Addresses table: Address_ID Line_1 Line_2 City_Town State_County Other_Details 110 4753 Dach Highway Suite 846 Feliciaberg Florida None 124 391 Vandervort Fall Apt. 446 Apt. 107 West Sherwoodstad Indiana None 148 809 Izabella Islands Suite 271 Schadenville Ohio None CREATE TABLE Products ( Product_ID VARCHAR(100) NOT NULL, Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Product_Description VARCHAR(255), Other_Product_Service_Details VARCHAR(255), PRIMARY KEY (Product_ID), UNIQUE (Product_ID) ) 3 rows from Products table: Product_ID Product_Name Product_Price Product_Description Other_Product_Service_Details 11 photo 4448536 None None 154 film 2302 None None 156 film 17622723 None None CREATE TABLE Marketing_Regions ( Marketing_Region_Code CHAR(15) NOT NULL, Marketing_Region_Name VARCHAR(255) NOT NULL, Marketing_Region_Descriptrion VARCHAR(255) NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Marketing_Region_Code), UNIQUE (Marketing_Region_Code) ) 3 rows from Marketing_Regions table: Marketing_Region_Code Marketing_Region_Name Marketing_Region_Descriptrion Other_Details CA Canada Our target market None CN China Our largest market None ES Spain None CREATE TABLE Clients ( Client_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Customer_Email_Address VARCHAR(255), Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Client_ID), UNIQUE (Client_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Clients table: Client_ID Address_ID Customer_Email_Address Customer_Name Customer_Phone Other_Details 423 201 branson94@example.net Clifford (042)912-3404x5135 VIP 426 383 alba04@example.com Bettye (604)849-0214 None 478 15 westley30@example.net Reinhold 1-048-214-4640x64380 None CREATE TABLE Drama_Workshop_Groups ( Workshop_Group_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Currency_Code CHAR(15) NOT NULL, Marketing_Region_Code CHAR(15) NOT NULL, Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Workshop_Group_ID), UNIQUE (Workshop_Group_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Drama_Workshop_Groups table: Workshop_Group_ID Address_ID Currency_Code Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 136 383 EU FR Amely Cafe 122-084-8029 amely.ruecker@example.com None 140 180 EU DE Veda Film 793-966-9311x5303 breitenberg.veda@example.com None 176 286 EU RU Queen Art 492-463-5967 quigley.queen@example.org Good CREATE TABLE Performers ( Performer_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Performer_ID), UNIQUE (Performer_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Performers table: Performer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 153 124 Shawna 664.495.1939 krogahn@example.com None 211 124 Ashley 893-536-8857 preston45@example.net None 313 39 Oren 1-952-052-6685x28082 ferry.carolina@example.net None CREATE TABLE Customers ( Customer_ID VARCHAR(100) NOT NULL, Address_ID INTEGER NOT NULL, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Customer_ID), UNIQUE (Customer_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Customers table: Customer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 240 286 Harold 624-096-7791 jerde.harmon@example.com None 267 98 Federico 914-915-7483 johnson27@example.com None 304 369 Samson 1-463-121-4086x655 dalton75@example.com None CREATE TABLE Stores ( Store_ID VARCHAR(100) NOT NULL, Address_ID INTEGER NOT NULL, Marketing_Region_Code CHAR(15) NOT NULL, Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Store_ID), UNIQUE (Store_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID), FOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code) ) 3 rows from Stores table: Store_ID Address_ID Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 150 286 IN FJA Filming +65(1)3590790358 fjacobson@example.com None 229 266 CA Rob Dinning 1-327-185-9368 rborer@example.org 5 stars 231 230 ES Adan Dinning 896-931-9633x869 adan93@example.com None CREATE TABLE Bookings ( Booking_ID INTEGER NOT NULL , Customer_ID INTEGER NOT NULL, Workshop_Group_ID VARCHAR(100) NOT NULL, Status_Code CHAR(15) NOT NULL, Store_ID INTEGER NOT NULL, Order_Date DATETIME NOT NULL, Planned_Delivery_Date DATETIME NOT NULL, Actual_Delivery_Date DATETIME NOT NULL, Other_Order_Details VARCHAR(255), PRIMARY KEY (Booking_ID), UNIQUE (Booking_ID), FOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID), FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID) ) 3 rows from Bookings table: Booking_ID Customer_ID Workshop_Group_ID Status_Code Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 938 140 good 8 2016-12-12 10:43:01 2013-03-10 18:47:05 1997-11-21 10:07:40 None 2 868 838 stop 7 1976-08-20 00:33:08 2009-07-09 09:18:38 1976-01-08 07:19:23 None 3 735 176 good 9 1975-11-23 06:28:47 1989-01-05 19:24:45 1990-03-16 19:38:47 None CREATE TABLE Performers_in_Bookings ( Order_ID INTEGER NOT NULL, Performer_ID INTEGER NOT NULL, PRIMARY KEY (Order_ID, Performer_ID), FOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID) ) 3 rows from Performers_in_Bookings table: Order_ID Performer_ID 1 153 1 341 2 466 CREATE TABLE Customer_Orders ( Order_ID INTEGER NOT NULL , Customer_ID INTEGER NOT NULL, Store_ID INTEGER NOT NULL, Order_Date DATETIME NOT NULL, Planned_Delivery_Date DATETIME NOT NULL, Actual_Delivery_Date DATETIME NOT NULL, Other_Order_Details VARCHAR(255), PRIMARY KEY (Order_ID), UNIQUE (Order_ID), FOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID), FOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID) ) 3 rows from Customer_Orders table: Order_ID Customer_ID Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 516 231 1994-08-03 12:34:58 1977-03-11 03:58:19 1992-07-21 22:11:11 None 2 418 229 2014-07-10 10:56:01 1996-08-26 19:19:59 1998-08-22 17:57:32 None 3 712 229 1981-06-20 16:29:43 1980-12-19 05:49:35 2011-04-13 07:15:35 None CREATE TABLE Order_Items ( Order_Item_ID INTEGER NOT NULL , Order_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), PRIMARY KEY (Order_Item_ID), FOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID), FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID) ) 3 rows from Order_Items table: Order_Item_ID Order_ID Product_ID Order_Quantity Other_Item_Details 1 3 233 1 None 2 15 300 2 None 3 12 300 1 None CREATE TABLE Invoices ( Invoice_ID INTEGER NOT NULL, Order_ID INTEGER NOT NULL, payment_method_code CHAR(15), Product_ID INTEGER NOT NULL, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), Order_Item_ID INTEGER NOT NULL, PRIMARY KEY (Invoice_ID), FOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID), FOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code) ) 3 rows from Invoices table: Invoice_ID Order_ID payment_method_code Product_ID Order_Quantity Other_Item_Details Order_Item_ID 128 14 MasterCard 4 2 None 1 162 13 MasterCard 9 2 None 9 164 7 Visa 7 2 None 1 CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR(15), Workshop_Group_ID INTEGER NOT NULL, Product_Description VARCHAR(255), Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Other_Product_Service_Details VARCHAR(255), PRIMARY KEY (Service_ID), UNIQUE (Service_ID), FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID), FOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code) ) 3 rows from Services table: Service_ID Service_Type_Code Workshop_Group_ID Product_Description Product_Name Product_Price Other_Product_Service_Details 191 1 415 None film 5.893278e+07 None 219 2 838 None film 2.704472e+03 None 220 1 708 None dinning 6.888831e+03 None CREATE TABLE Bookings_Services ( Order_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, PRIMARY KEY (Order_ID, Product_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID), FOREIGN KEY (Product_ID) REFERENCES Services (Service_ID) ) 3 rows from Bookings_Services table: Order_ID Product_ID 1 396 1 779 4 191 CREATE TABLE Invoice_Items ( Invoice_Item_ID INTEGER NOT NULL , Invoice_ID INTEGER NOT NULL, Order_ID INTEGER NOT NULL, Order_Item_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, Order_Quantity INTEGER, Other_Item_Details VARCHAR(255), PRIMARY KEY (Invoice_Item_ID), FOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID), FOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID), FOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID) ) 3 rows from Invoice_Items table: Invoice_Item_ID Invoice_ID Order_ID Order_Item_ID Product_ID Order_Quantity Other_Item_Details 1 128 1 5 396 2 None 2 162 4 6 191 6 Good quality
cre_Drama_Workshop_Groups
Count the total number of bookings made.
SELECT count(*) FROM BOOKINGS
CREATE TABLE Ref_Payment_Methods ( payment_method_code CHAR(10) NOT NULL, payment_method_description VARCHAR(80), PRIMARY KEY (payment_method_code), UNIQUE (payment_method_code) ) 3 rows from Ref_Payment_Methods table: payment_method_code payment_method_description American E credit MasterCard debit Visa Visa CREATE TABLE Ref_Service_Types ( Service_Type_Code CHAR(15) NOT NULL, Parent_Service_Type_Code CHAR(15), Service_Type_Description VARCHAR(255), PRIMARY KEY (Service_Type_Code), UNIQUE (Service_Type_Code) ) 3 rows from Ref_Service_Types table: Service_Type_Code Parent_Service_Type_Code Service_Type_Description 1 1 provide photo service 2 1 provide dinning service 3 1 provide filming service CREATE TABLE Addresses ( Address_ID VARCHAR(100) NOT NULL, Line_1 VARCHAR(255), Line_2 VARCHAR(255), City_Town VARCHAR(255), State_County VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Address_ID), UNIQUE (Address_ID) ) 3 rows from Addresses table: Address_ID Line_1 Line_2 City_Town State_County Other_Details 110 4753 Dach Highway Suite 846 Feliciaberg Florida None 124 391 Vandervort Fall Apt. 446 Apt. 107 West Sherwoodstad Indiana None 148 809 Izabella Islands Suite 271 Schadenville Ohio None CREATE TABLE Products ( Product_ID VARCHAR(100) NOT NULL, Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Product_Description VARCHAR(255), Other_Product_Service_Details VARCHAR(255), PRIMARY KEY (Product_ID), UNIQUE (Product_ID) ) 3 rows from Products table: Product_ID Product_Name Product_Price Product_Description Other_Product_Service_Details 11 photo 4448536 None None 154 film 2302 None None 156 film 17622723 None None CREATE TABLE Marketing_Regions ( Marketing_Region_Code CHAR(15) NOT NULL, Marketing_Region_Name VARCHAR(255) NOT NULL, Marketing_Region_Descriptrion VARCHAR(255) NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Marketing_Region_Code), UNIQUE (Marketing_Region_Code) ) 3 rows from Marketing_Regions table: Marketing_Region_Code Marketing_Region_Name Marketing_Region_Descriptrion Other_Details CA Canada Our target market None CN China Our largest market None ES Spain None CREATE TABLE Clients ( Client_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Customer_Email_Address VARCHAR(255), Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Client_ID), UNIQUE (Client_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Clients table: Client_ID Address_ID Customer_Email_Address Customer_Name Customer_Phone Other_Details 423 201 branson94@example.net Clifford (042)912-3404x5135 VIP 426 383 alba04@example.com Bettye (604)849-0214 None 478 15 westley30@example.net Reinhold 1-048-214-4640x64380 None CREATE TABLE Drama_Workshop_Groups ( Workshop_Group_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Currency_Code CHAR(15) NOT NULL, Marketing_Region_Code CHAR(15) NOT NULL, Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Workshop_Group_ID), UNIQUE (Workshop_Group_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Drama_Workshop_Groups table: Workshop_Group_ID Address_ID Currency_Code Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 136 383 EU FR Amely Cafe 122-084-8029 amely.ruecker@example.com None 140 180 EU DE Veda Film 793-966-9311x5303 breitenberg.veda@example.com None 176 286 EU RU Queen Art 492-463-5967 quigley.queen@example.org Good CREATE TABLE Performers ( Performer_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Performer_ID), UNIQUE (Performer_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Performers table: Performer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 153 124 Shawna 664.495.1939 krogahn@example.com None 211 124 Ashley 893-536-8857 preston45@example.net None 313 39 Oren 1-952-052-6685x28082 ferry.carolina@example.net None CREATE TABLE Customers ( Customer_ID VARCHAR(100) NOT NULL, Address_ID INTEGER NOT NULL, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Customer_ID), UNIQUE (Customer_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Customers table: Customer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 240 286 Harold 624-096-7791 jerde.harmon@example.com None 267 98 Federico 914-915-7483 johnson27@example.com None 304 369 Samson 1-463-121-4086x655 dalton75@example.com None CREATE TABLE Stores ( Store_ID VARCHAR(100) NOT NULL, Address_ID INTEGER NOT NULL, Marketing_Region_Code CHAR(15) NOT NULL, Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Store_ID), UNIQUE (Store_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID), FOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code) ) 3 rows from Stores table: Store_ID Address_ID Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 150 286 IN FJA Filming +65(1)3590790358 fjacobson@example.com None 229 266 CA Rob Dinning 1-327-185-9368 rborer@example.org 5 stars 231 230 ES Adan Dinning 896-931-9633x869 adan93@example.com None CREATE TABLE Bookings ( Booking_ID INTEGER NOT NULL , Customer_ID INTEGER NOT NULL, Workshop_Group_ID VARCHAR(100) NOT NULL, Status_Code CHAR(15) NOT NULL, Store_ID INTEGER NOT NULL, Order_Date DATETIME NOT NULL, Planned_Delivery_Date DATETIME NOT NULL, Actual_Delivery_Date DATETIME NOT NULL, Other_Order_Details VARCHAR(255), PRIMARY KEY (Booking_ID), UNIQUE (Booking_ID), FOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID), FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID) ) 3 rows from Bookings table: Booking_ID Customer_ID Workshop_Group_ID Status_Code Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 938 140 good 8 2016-12-12 10:43:01 2013-03-10 18:47:05 1997-11-21 10:07:40 None 2 868 838 stop 7 1976-08-20 00:33:08 2009-07-09 09:18:38 1976-01-08 07:19:23 None 3 735 176 good 9 1975-11-23 06:28:47 1989-01-05 19:24:45 1990-03-16 19:38:47 None CREATE TABLE Performers_in_Bookings ( Order_ID INTEGER NOT NULL, Performer_ID INTEGER NOT NULL, PRIMARY KEY (Order_ID, Performer_ID), FOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID) ) 3 rows from Performers_in_Bookings table: Order_ID Performer_ID 1 153 1 341 2 466 CREATE TABLE Customer_Orders ( Order_ID INTEGER NOT NULL , Customer_ID INTEGER NOT NULL, Store_ID INTEGER NOT NULL, Order_Date DATETIME NOT NULL, Planned_Delivery_Date DATETIME NOT NULL, Actual_Delivery_Date DATETIME NOT NULL, Other_Order_Details VARCHAR(255), PRIMARY KEY (Order_ID), UNIQUE (Order_ID), FOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID), FOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID) ) 3 rows from Customer_Orders table: Order_ID Customer_ID Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 516 231 1994-08-03 12:34:58 1977-03-11 03:58:19 1992-07-21 22:11:11 None 2 418 229 2014-07-10 10:56:01 1996-08-26 19:19:59 1998-08-22 17:57:32 None 3 712 229 1981-06-20 16:29:43 1980-12-19 05:49:35 2011-04-13 07:15:35 None CREATE TABLE Order_Items ( Order_Item_ID INTEGER NOT NULL , Order_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), PRIMARY KEY (Order_Item_ID), FOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID), FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID) ) 3 rows from Order_Items table: Order_Item_ID Order_ID Product_ID Order_Quantity Other_Item_Details 1 3 233 1 None 2 15 300 2 None 3 12 300 1 None CREATE TABLE Invoices ( Invoice_ID INTEGER NOT NULL, Order_ID INTEGER NOT NULL, payment_method_code CHAR(15), Product_ID INTEGER NOT NULL, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), Order_Item_ID INTEGER NOT NULL, PRIMARY KEY (Invoice_ID), FOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID), FOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code) ) 3 rows from Invoices table: Invoice_ID Order_ID payment_method_code Product_ID Order_Quantity Other_Item_Details Order_Item_ID 128 14 MasterCard 4 2 None 1 162 13 MasterCard 9 2 None 9 164 7 Visa 7 2 None 1 CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR(15), Workshop_Group_ID INTEGER NOT NULL, Product_Description VARCHAR(255), Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Other_Product_Service_Details VARCHAR(255), PRIMARY KEY (Service_ID), UNIQUE (Service_ID), FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID), FOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code) ) 3 rows from Services table: Service_ID Service_Type_Code Workshop_Group_ID Product_Description Product_Name Product_Price Other_Product_Service_Details 191 1 415 None film 5.893278e+07 None 219 2 838 None film 2.704472e+03 None 220 1 708 None dinning 6.888831e+03 None CREATE TABLE Bookings_Services ( Order_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, PRIMARY KEY (Order_ID, Product_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID), FOREIGN KEY (Product_ID) REFERENCES Services (Service_ID) ) 3 rows from Bookings_Services table: Order_ID Product_ID 1 396 1 779 4 191 CREATE TABLE Invoice_Items ( Invoice_Item_ID INTEGER NOT NULL , Invoice_ID INTEGER NOT NULL, Order_ID INTEGER NOT NULL, Order_Item_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, Order_Quantity INTEGER, Other_Item_Details VARCHAR(255), PRIMARY KEY (Invoice_Item_ID), FOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID), FOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID), FOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID) ) 3 rows from Invoice_Items table: Invoice_Item_ID Invoice_ID Order_ID Order_Item_ID Product_ID Order_Quantity Other_Item_Details 1 128 1 5 396 2 None 2 162 4 6 191 6 Good quality
cre_Drama_Workshop_Groups
List the order dates of all the bookings.
SELECT Order_Date FROM BOOKINGS
CREATE TABLE Ref_Payment_Methods ( payment_method_code CHAR(10) NOT NULL, payment_method_description VARCHAR(80), PRIMARY KEY (payment_method_code), UNIQUE (payment_method_code) ) 3 rows from Ref_Payment_Methods table: payment_method_code payment_method_description American E credit MasterCard debit Visa Visa CREATE TABLE Ref_Service_Types ( Service_Type_Code CHAR(15) NOT NULL, Parent_Service_Type_Code CHAR(15), Service_Type_Description VARCHAR(255), PRIMARY KEY (Service_Type_Code), UNIQUE (Service_Type_Code) ) 3 rows from Ref_Service_Types table: Service_Type_Code Parent_Service_Type_Code Service_Type_Description 1 1 provide photo service 2 1 provide dinning service 3 1 provide filming service CREATE TABLE Addresses ( Address_ID VARCHAR(100) NOT NULL, Line_1 VARCHAR(255), Line_2 VARCHAR(255), City_Town VARCHAR(255), State_County VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Address_ID), UNIQUE (Address_ID) ) 3 rows from Addresses table: Address_ID Line_1 Line_2 City_Town State_County Other_Details 110 4753 Dach Highway Suite 846 Feliciaberg Florida None 124 391 Vandervort Fall Apt. 446 Apt. 107 West Sherwoodstad Indiana None 148 809 Izabella Islands Suite 271 Schadenville Ohio None CREATE TABLE Products ( Product_ID VARCHAR(100) NOT NULL, Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Product_Description VARCHAR(255), Other_Product_Service_Details VARCHAR(255), PRIMARY KEY (Product_ID), UNIQUE (Product_ID) ) 3 rows from Products table: Product_ID Product_Name Product_Price Product_Description Other_Product_Service_Details 11 photo 4448536 None None 154 film 2302 None None 156 film 17622723 None None CREATE TABLE Marketing_Regions ( Marketing_Region_Code CHAR(15) NOT NULL, Marketing_Region_Name VARCHAR(255) NOT NULL, Marketing_Region_Descriptrion VARCHAR(255) NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Marketing_Region_Code), UNIQUE (Marketing_Region_Code) ) 3 rows from Marketing_Regions table: Marketing_Region_Code Marketing_Region_Name Marketing_Region_Descriptrion Other_Details CA Canada Our target market None CN China Our largest market None ES Spain None CREATE TABLE Clients ( Client_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Customer_Email_Address VARCHAR(255), Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Client_ID), UNIQUE (Client_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Clients table: Client_ID Address_ID Customer_Email_Address Customer_Name Customer_Phone Other_Details 423 201 branson94@example.net Clifford (042)912-3404x5135 VIP 426 383 alba04@example.com Bettye (604)849-0214 None 478 15 westley30@example.net Reinhold 1-048-214-4640x64380 None CREATE TABLE Drama_Workshop_Groups ( Workshop_Group_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Currency_Code CHAR(15) NOT NULL, Marketing_Region_Code CHAR(15) NOT NULL, Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Workshop_Group_ID), UNIQUE (Workshop_Group_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Drama_Workshop_Groups table: Workshop_Group_ID Address_ID Currency_Code Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 136 383 EU FR Amely Cafe 122-084-8029 amely.ruecker@example.com None 140 180 EU DE Veda Film 793-966-9311x5303 breitenberg.veda@example.com None 176 286 EU RU Queen Art 492-463-5967 quigley.queen@example.org Good CREATE TABLE Performers ( Performer_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Performer_ID), UNIQUE (Performer_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Performers table: Performer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 153 124 Shawna 664.495.1939 krogahn@example.com None 211 124 Ashley 893-536-8857 preston45@example.net None 313 39 Oren 1-952-052-6685x28082 ferry.carolina@example.net None CREATE TABLE Customers ( Customer_ID VARCHAR(100) NOT NULL, Address_ID INTEGER NOT NULL, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Customer_ID), UNIQUE (Customer_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Customers table: Customer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 240 286 Harold 624-096-7791 jerde.harmon@example.com None 267 98 Federico 914-915-7483 johnson27@example.com None 304 369 Samson 1-463-121-4086x655 dalton75@example.com None CREATE TABLE Stores ( Store_ID VARCHAR(100) NOT NULL, Address_ID INTEGER NOT NULL, Marketing_Region_Code CHAR(15) NOT NULL, Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Store_ID), UNIQUE (Store_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID), FOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code) ) 3 rows from Stores table: Store_ID Address_ID Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 150 286 IN FJA Filming +65(1)3590790358 fjacobson@example.com None 229 266 CA Rob Dinning 1-327-185-9368 rborer@example.org 5 stars 231 230 ES Adan Dinning 896-931-9633x869 adan93@example.com None CREATE TABLE Bookings ( Booking_ID INTEGER NOT NULL , Customer_ID INTEGER NOT NULL, Workshop_Group_ID VARCHAR(100) NOT NULL, Status_Code CHAR(15) NOT NULL, Store_ID INTEGER NOT NULL, Order_Date DATETIME NOT NULL, Planned_Delivery_Date DATETIME NOT NULL, Actual_Delivery_Date DATETIME NOT NULL, Other_Order_Details VARCHAR(255), PRIMARY KEY (Booking_ID), UNIQUE (Booking_ID), FOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID), FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID) ) 3 rows from Bookings table: Booking_ID Customer_ID Workshop_Group_ID Status_Code Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 938 140 good 8 2016-12-12 10:43:01 2013-03-10 18:47:05 1997-11-21 10:07:40 None 2 868 838 stop 7 1976-08-20 00:33:08 2009-07-09 09:18:38 1976-01-08 07:19:23 None 3 735 176 good 9 1975-11-23 06:28:47 1989-01-05 19:24:45 1990-03-16 19:38:47 None CREATE TABLE Performers_in_Bookings ( Order_ID INTEGER NOT NULL, Performer_ID INTEGER NOT NULL, PRIMARY KEY (Order_ID, Performer_ID), FOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID) ) 3 rows from Performers_in_Bookings table: Order_ID Performer_ID 1 153 1 341 2 466 CREATE TABLE Customer_Orders ( Order_ID INTEGER NOT NULL , Customer_ID INTEGER NOT NULL, Store_ID INTEGER NOT NULL, Order_Date DATETIME NOT NULL, Planned_Delivery_Date DATETIME NOT NULL, Actual_Delivery_Date DATETIME NOT NULL, Other_Order_Details VARCHAR(255), PRIMARY KEY (Order_ID), UNIQUE (Order_ID), FOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID), FOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID) ) 3 rows from Customer_Orders table: Order_ID Customer_ID Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 516 231 1994-08-03 12:34:58 1977-03-11 03:58:19 1992-07-21 22:11:11 None 2 418 229 2014-07-10 10:56:01 1996-08-26 19:19:59 1998-08-22 17:57:32 None 3 712 229 1981-06-20 16:29:43 1980-12-19 05:49:35 2011-04-13 07:15:35 None CREATE TABLE Order_Items ( Order_Item_ID INTEGER NOT NULL , Order_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), PRIMARY KEY (Order_Item_ID), FOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID), FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID) ) 3 rows from Order_Items table: Order_Item_ID Order_ID Product_ID Order_Quantity Other_Item_Details 1 3 233 1 None 2 15 300 2 None 3 12 300 1 None CREATE TABLE Invoices ( Invoice_ID INTEGER NOT NULL, Order_ID INTEGER NOT NULL, payment_method_code CHAR(15), Product_ID INTEGER NOT NULL, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), Order_Item_ID INTEGER NOT NULL, PRIMARY KEY (Invoice_ID), FOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID), FOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code) ) 3 rows from Invoices table: Invoice_ID Order_ID payment_method_code Product_ID Order_Quantity Other_Item_Details Order_Item_ID 128 14 MasterCard 4 2 None 1 162 13 MasterCard 9 2 None 9 164 7 Visa 7 2 None 1 CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR(15), Workshop_Group_ID INTEGER NOT NULL, Product_Description VARCHAR(255), Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Other_Product_Service_Details VARCHAR(255), PRIMARY KEY (Service_ID), UNIQUE (Service_ID), FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID), FOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code) ) 3 rows from Services table: Service_ID Service_Type_Code Workshop_Group_ID Product_Description Product_Name Product_Price Other_Product_Service_Details 191 1 415 None film 5.893278e+07 None 219 2 838 None film 2.704472e+03 None 220 1 708 None dinning 6.888831e+03 None CREATE TABLE Bookings_Services ( Order_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, PRIMARY KEY (Order_ID, Product_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID), FOREIGN KEY (Product_ID) REFERENCES Services (Service_ID) ) 3 rows from Bookings_Services table: Order_ID Product_ID 1 396 1 779 4 191 CREATE TABLE Invoice_Items ( Invoice_Item_ID INTEGER NOT NULL , Invoice_ID INTEGER NOT NULL, Order_ID INTEGER NOT NULL, Order_Item_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, Order_Quantity INTEGER, Other_Item_Details VARCHAR(255), PRIMARY KEY (Invoice_Item_ID), FOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID), FOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID), FOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID) ) 3 rows from Invoice_Items table: Invoice_Item_ID Invoice_ID Order_ID Order_Item_ID Product_ID Order_Quantity Other_Item_Details 1 128 1 5 396 2 None 2 162 4 6 191 6 Good quality
cre_Drama_Workshop_Groups
What is the order date of each booking?
SELECT Order_Date FROM BOOKINGS
CREATE TABLE Ref_Payment_Methods ( payment_method_code CHAR(10) NOT NULL, payment_method_description VARCHAR(80), PRIMARY KEY (payment_method_code), UNIQUE (payment_method_code) ) 3 rows from Ref_Payment_Methods table: payment_method_code payment_method_description American E credit MasterCard debit Visa Visa CREATE TABLE Ref_Service_Types ( Service_Type_Code CHAR(15) NOT NULL, Parent_Service_Type_Code CHAR(15), Service_Type_Description VARCHAR(255), PRIMARY KEY (Service_Type_Code), UNIQUE (Service_Type_Code) ) 3 rows from Ref_Service_Types table: Service_Type_Code Parent_Service_Type_Code Service_Type_Description 1 1 provide photo service 2 1 provide dinning service 3 1 provide filming service CREATE TABLE Addresses ( Address_ID VARCHAR(100) NOT NULL, Line_1 VARCHAR(255), Line_2 VARCHAR(255), City_Town VARCHAR(255), State_County VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Address_ID), UNIQUE (Address_ID) ) 3 rows from Addresses table: Address_ID Line_1 Line_2 City_Town State_County Other_Details 110 4753 Dach Highway Suite 846 Feliciaberg Florida None 124 391 Vandervort Fall Apt. 446 Apt. 107 West Sherwoodstad Indiana None 148 809 Izabella Islands Suite 271 Schadenville Ohio None CREATE TABLE Products ( Product_ID VARCHAR(100) NOT NULL, Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Product_Description VARCHAR(255), Other_Product_Service_Details VARCHAR(255), PRIMARY KEY (Product_ID), UNIQUE (Product_ID) ) 3 rows from Products table: Product_ID Product_Name Product_Price Product_Description Other_Product_Service_Details 11 photo 4448536 None None 154 film 2302 None None 156 film 17622723 None None CREATE TABLE Marketing_Regions ( Marketing_Region_Code CHAR(15) NOT NULL, Marketing_Region_Name VARCHAR(255) NOT NULL, Marketing_Region_Descriptrion VARCHAR(255) NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Marketing_Region_Code), UNIQUE (Marketing_Region_Code) ) 3 rows from Marketing_Regions table: Marketing_Region_Code Marketing_Region_Name Marketing_Region_Descriptrion Other_Details CA Canada Our target market None CN China Our largest market None ES Spain None CREATE TABLE Clients ( Client_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Customer_Email_Address VARCHAR(255), Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Client_ID), UNIQUE (Client_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Clients table: Client_ID Address_ID Customer_Email_Address Customer_Name Customer_Phone Other_Details 423 201 branson94@example.net Clifford (042)912-3404x5135 VIP 426 383 alba04@example.com Bettye (604)849-0214 None 478 15 westley30@example.net Reinhold 1-048-214-4640x64380 None CREATE TABLE Drama_Workshop_Groups ( Workshop_Group_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Currency_Code CHAR(15) NOT NULL, Marketing_Region_Code CHAR(15) NOT NULL, Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Workshop_Group_ID), UNIQUE (Workshop_Group_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Drama_Workshop_Groups table: Workshop_Group_ID Address_ID Currency_Code Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 136 383 EU FR Amely Cafe 122-084-8029 amely.ruecker@example.com None 140 180 EU DE Veda Film 793-966-9311x5303 breitenberg.veda@example.com None 176 286 EU RU Queen Art 492-463-5967 quigley.queen@example.org Good CREATE TABLE Performers ( Performer_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Performer_ID), UNIQUE (Performer_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Performers table: Performer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 153 124 Shawna 664.495.1939 krogahn@example.com None 211 124 Ashley 893-536-8857 preston45@example.net None 313 39 Oren 1-952-052-6685x28082 ferry.carolina@example.net None CREATE TABLE Customers ( Customer_ID VARCHAR(100) NOT NULL, Address_ID INTEGER NOT NULL, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Customer_ID), UNIQUE (Customer_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Customers table: Customer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 240 286 Harold 624-096-7791 jerde.harmon@example.com None 267 98 Federico 914-915-7483 johnson27@example.com None 304 369 Samson 1-463-121-4086x655 dalton75@example.com None CREATE TABLE Stores ( Store_ID VARCHAR(100) NOT NULL, Address_ID INTEGER NOT NULL, Marketing_Region_Code CHAR(15) NOT NULL, Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Store_ID), UNIQUE (Store_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID), FOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code) ) 3 rows from Stores table: Store_ID Address_ID Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 150 286 IN FJA Filming +65(1)3590790358 fjacobson@example.com None 229 266 CA Rob Dinning 1-327-185-9368 rborer@example.org 5 stars 231 230 ES Adan Dinning 896-931-9633x869 adan93@example.com None CREATE TABLE Bookings ( Booking_ID INTEGER NOT NULL , Customer_ID INTEGER NOT NULL, Workshop_Group_ID VARCHAR(100) NOT NULL, Status_Code CHAR(15) NOT NULL, Store_ID INTEGER NOT NULL, Order_Date DATETIME NOT NULL, Planned_Delivery_Date DATETIME NOT NULL, Actual_Delivery_Date DATETIME NOT NULL, Other_Order_Details VARCHAR(255), PRIMARY KEY (Booking_ID), UNIQUE (Booking_ID), FOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID), FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID) ) 3 rows from Bookings table: Booking_ID Customer_ID Workshop_Group_ID Status_Code Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 938 140 good 8 2016-12-12 10:43:01 2013-03-10 18:47:05 1997-11-21 10:07:40 None 2 868 838 stop 7 1976-08-20 00:33:08 2009-07-09 09:18:38 1976-01-08 07:19:23 None 3 735 176 good 9 1975-11-23 06:28:47 1989-01-05 19:24:45 1990-03-16 19:38:47 None CREATE TABLE Performers_in_Bookings ( Order_ID INTEGER NOT NULL, Performer_ID INTEGER NOT NULL, PRIMARY KEY (Order_ID, Performer_ID), FOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID) ) 3 rows from Performers_in_Bookings table: Order_ID Performer_ID 1 153 1 341 2 466 CREATE TABLE Customer_Orders ( Order_ID INTEGER NOT NULL , Customer_ID INTEGER NOT NULL, Store_ID INTEGER NOT NULL, Order_Date DATETIME NOT NULL, Planned_Delivery_Date DATETIME NOT NULL, Actual_Delivery_Date DATETIME NOT NULL, Other_Order_Details VARCHAR(255), PRIMARY KEY (Order_ID), UNIQUE (Order_ID), FOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID), FOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID) ) 3 rows from Customer_Orders table: Order_ID Customer_ID Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 516 231 1994-08-03 12:34:58 1977-03-11 03:58:19 1992-07-21 22:11:11 None 2 418 229 2014-07-10 10:56:01 1996-08-26 19:19:59 1998-08-22 17:57:32 None 3 712 229 1981-06-20 16:29:43 1980-12-19 05:49:35 2011-04-13 07:15:35 None CREATE TABLE Order_Items ( Order_Item_ID INTEGER NOT NULL , Order_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), PRIMARY KEY (Order_Item_ID), FOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID), FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID) ) 3 rows from Order_Items table: Order_Item_ID Order_ID Product_ID Order_Quantity Other_Item_Details 1 3 233 1 None 2 15 300 2 None 3 12 300 1 None CREATE TABLE Invoices ( Invoice_ID INTEGER NOT NULL, Order_ID INTEGER NOT NULL, payment_method_code CHAR(15), Product_ID INTEGER NOT NULL, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), Order_Item_ID INTEGER NOT NULL, PRIMARY KEY (Invoice_ID), FOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID), FOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code) ) 3 rows from Invoices table: Invoice_ID Order_ID payment_method_code Product_ID Order_Quantity Other_Item_Details Order_Item_ID 128 14 MasterCard 4 2 None 1 162 13 MasterCard 9 2 None 9 164 7 Visa 7 2 None 1 CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR(15), Workshop_Group_ID INTEGER NOT NULL, Product_Description VARCHAR(255), Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Other_Product_Service_Details VARCHAR(255), PRIMARY KEY (Service_ID), UNIQUE (Service_ID), FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID), FOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code) ) 3 rows from Services table: Service_ID Service_Type_Code Workshop_Group_ID Product_Description Product_Name Product_Price Other_Product_Service_Details 191 1 415 None film 5.893278e+07 None 219 2 838 None film 2.704472e+03 None 220 1 708 None dinning 6.888831e+03 None CREATE TABLE Bookings_Services ( Order_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, PRIMARY KEY (Order_ID, Product_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID), FOREIGN KEY (Product_ID) REFERENCES Services (Service_ID) ) 3 rows from Bookings_Services table: Order_ID Product_ID 1 396 1 779 4 191 CREATE TABLE Invoice_Items ( Invoice_Item_ID INTEGER NOT NULL , Invoice_ID INTEGER NOT NULL, Order_ID INTEGER NOT NULL, Order_Item_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, Order_Quantity INTEGER, Other_Item_Details VARCHAR(255), PRIMARY KEY (Invoice_Item_ID), FOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID), FOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID), FOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID) ) 3 rows from Invoice_Items table: Invoice_Item_ID Invoice_ID Order_ID Order_Item_ID Product_ID Order_Quantity Other_Item_Details 1 128 1 5 396 2 None 2 162 4 6 191 6 Good quality
cre_Drama_Workshop_Groups
Show all the planned delivery dates and actual delivery dates of bookings.
SELECT Planned_Delivery_Date , Actual_Delivery_Date FROM BOOKINGS
CREATE TABLE Ref_Payment_Methods ( payment_method_code CHAR(10) NOT NULL, payment_method_description VARCHAR(80), PRIMARY KEY (payment_method_code), UNIQUE (payment_method_code) ) 3 rows from Ref_Payment_Methods table: payment_method_code payment_method_description American E credit MasterCard debit Visa Visa CREATE TABLE Ref_Service_Types ( Service_Type_Code CHAR(15) NOT NULL, Parent_Service_Type_Code CHAR(15), Service_Type_Description VARCHAR(255), PRIMARY KEY (Service_Type_Code), UNIQUE (Service_Type_Code) ) 3 rows from Ref_Service_Types table: Service_Type_Code Parent_Service_Type_Code Service_Type_Description 1 1 provide photo service 2 1 provide dinning service 3 1 provide filming service CREATE TABLE Addresses ( Address_ID VARCHAR(100) NOT NULL, Line_1 VARCHAR(255), Line_2 VARCHAR(255), City_Town VARCHAR(255), State_County VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Address_ID), UNIQUE (Address_ID) ) 3 rows from Addresses table: Address_ID Line_1 Line_2 City_Town State_County Other_Details 110 4753 Dach Highway Suite 846 Feliciaberg Florida None 124 391 Vandervort Fall Apt. 446 Apt. 107 West Sherwoodstad Indiana None 148 809 Izabella Islands Suite 271 Schadenville Ohio None CREATE TABLE Products ( Product_ID VARCHAR(100) NOT NULL, Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Product_Description VARCHAR(255), Other_Product_Service_Details VARCHAR(255), PRIMARY KEY (Product_ID), UNIQUE (Product_ID) ) 3 rows from Products table: Product_ID Product_Name Product_Price Product_Description Other_Product_Service_Details 11 photo 4448536 None None 154 film 2302 None None 156 film 17622723 None None CREATE TABLE Marketing_Regions ( Marketing_Region_Code CHAR(15) NOT NULL, Marketing_Region_Name VARCHAR(255) NOT NULL, Marketing_Region_Descriptrion VARCHAR(255) NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Marketing_Region_Code), UNIQUE (Marketing_Region_Code) ) 3 rows from Marketing_Regions table: Marketing_Region_Code Marketing_Region_Name Marketing_Region_Descriptrion Other_Details CA Canada Our target market None CN China Our largest market None ES Spain None CREATE TABLE Clients ( Client_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Customer_Email_Address VARCHAR(255), Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Client_ID), UNIQUE (Client_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Clients table: Client_ID Address_ID Customer_Email_Address Customer_Name Customer_Phone Other_Details 423 201 branson94@example.net Clifford (042)912-3404x5135 VIP 426 383 alba04@example.com Bettye (604)849-0214 None 478 15 westley30@example.net Reinhold 1-048-214-4640x64380 None CREATE TABLE Drama_Workshop_Groups ( Workshop_Group_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Currency_Code CHAR(15) NOT NULL, Marketing_Region_Code CHAR(15) NOT NULL, Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Workshop_Group_ID), UNIQUE (Workshop_Group_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Drama_Workshop_Groups table: Workshop_Group_ID Address_ID Currency_Code Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 136 383 EU FR Amely Cafe 122-084-8029 amely.ruecker@example.com None 140 180 EU DE Veda Film 793-966-9311x5303 breitenberg.veda@example.com None 176 286 EU RU Queen Art 492-463-5967 quigley.queen@example.org Good CREATE TABLE Performers ( Performer_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Performer_ID), UNIQUE (Performer_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Performers table: Performer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 153 124 Shawna 664.495.1939 krogahn@example.com None 211 124 Ashley 893-536-8857 preston45@example.net None 313 39 Oren 1-952-052-6685x28082 ferry.carolina@example.net None CREATE TABLE Customers ( Customer_ID VARCHAR(100) NOT NULL, Address_ID INTEGER NOT NULL, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Customer_ID), UNIQUE (Customer_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Customers table: Customer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 240 286 Harold 624-096-7791 jerde.harmon@example.com None 267 98 Federico 914-915-7483 johnson27@example.com None 304 369 Samson 1-463-121-4086x655 dalton75@example.com None CREATE TABLE Stores ( Store_ID VARCHAR(100) NOT NULL, Address_ID INTEGER NOT NULL, Marketing_Region_Code CHAR(15) NOT NULL, Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Store_ID), UNIQUE (Store_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID), FOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code) ) 3 rows from Stores table: Store_ID Address_ID Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 150 286 IN FJA Filming +65(1)3590790358 fjacobson@example.com None 229 266 CA Rob Dinning 1-327-185-9368 rborer@example.org 5 stars 231 230 ES Adan Dinning 896-931-9633x869 adan93@example.com None CREATE TABLE Bookings ( Booking_ID INTEGER NOT NULL , Customer_ID INTEGER NOT NULL, Workshop_Group_ID VARCHAR(100) NOT NULL, Status_Code CHAR(15) NOT NULL, Store_ID INTEGER NOT NULL, Order_Date DATETIME NOT NULL, Planned_Delivery_Date DATETIME NOT NULL, Actual_Delivery_Date DATETIME NOT NULL, Other_Order_Details VARCHAR(255), PRIMARY KEY (Booking_ID), UNIQUE (Booking_ID), FOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID), FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID) ) 3 rows from Bookings table: Booking_ID Customer_ID Workshop_Group_ID Status_Code Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 938 140 good 8 2016-12-12 10:43:01 2013-03-10 18:47:05 1997-11-21 10:07:40 None 2 868 838 stop 7 1976-08-20 00:33:08 2009-07-09 09:18:38 1976-01-08 07:19:23 None 3 735 176 good 9 1975-11-23 06:28:47 1989-01-05 19:24:45 1990-03-16 19:38:47 None CREATE TABLE Performers_in_Bookings ( Order_ID INTEGER NOT NULL, Performer_ID INTEGER NOT NULL, PRIMARY KEY (Order_ID, Performer_ID), FOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID) ) 3 rows from Performers_in_Bookings table: Order_ID Performer_ID 1 153 1 341 2 466 CREATE TABLE Customer_Orders ( Order_ID INTEGER NOT NULL , Customer_ID INTEGER NOT NULL, Store_ID INTEGER NOT NULL, Order_Date DATETIME NOT NULL, Planned_Delivery_Date DATETIME NOT NULL, Actual_Delivery_Date DATETIME NOT NULL, Other_Order_Details VARCHAR(255), PRIMARY KEY (Order_ID), UNIQUE (Order_ID), FOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID), FOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID) ) 3 rows from Customer_Orders table: Order_ID Customer_ID Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 516 231 1994-08-03 12:34:58 1977-03-11 03:58:19 1992-07-21 22:11:11 None 2 418 229 2014-07-10 10:56:01 1996-08-26 19:19:59 1998-08-22 17:57:32 None 3 712 229 1981-06-20 16:29:43 1980-12-19 05:49:35 2011-04-13 07:15:35 None CREATE TABLE Order_Items ( Order_Item_ID INTEGER NOT NULL , Order_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), PRIMARY KEY (Order_Item_ID), FOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID), FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID) ) 3 rows from Order_Items table: Order_Item_ID Order_ID Product_ID Order_Quantity Other_Item_Details 1 3 233 1 None 2 15 300 2 None 3 12 300 1 None CREATE TABLE Invoices ( Invoice_ID INTEGER NOT NULL, Order_ID INTEGER NOT NULL, payment_method_code CHAR(15), Product_ID INTEGER NOT NULL, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), Order_Item_ID INTEGER NOT NULL, PRIMARY KEY (Invoice_ID), FOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID), FOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code) ) 3 rows from Invoices table: Invoice_ID Order_ID payment_method_code Product_ID Order_Quantity Other_Item_Details Order_Item_ID 128 14 MasterCard 4 2 None 1 162 13 MasterCard 9 2 None 9 164 7 Visa 7 2 None 1 CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR(15), Workshop_Group_ID INTEGER NOT NULL, Product_Description VARCHAR(255), Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Other_Product_Service_Details VARCHAR(255), PRIMARY KEY (Service_ID), UNIQUE (Service_ID), FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID), FOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code) ) 3 rows from Services table: Service_ID Service_Type_Code Workshop_Group_ID Product_Description Product_Name Product_Price Other_Product_Service_Details 191 1 415 None film 5.893278e+07 None 219 2 838 None film 2.704472e+03 None 220 1 708 None dinning 6.888831e+03 None CREATE TABLE Bookings_Services ( Order_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, PRIMARY KEY (Order_ID, Product_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID), FOREIGN KEY (Product_ID) REFERENCES Services (Service_ID) ) 3 rows from Bookings_Services table: Order_ID Product_ID 1 396 1 779 4 191 CREATE TABLE Invoice_Items ( Invoice_Item_ID INTEGER NOT NULL , Invoice_ID INTEGER NOT NULL, Order_ID INTEGER NOT NULL, Order_Item_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, Order_Quantity INTEGER, Other_Item_Details VARCHAR(255), PRIMARY KEY (Invoice_Item_ID), FOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID), FOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID), FOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID) ) 3 rows from Invoice_Items table: Invoice_Item_ID Invoice_ID Order_ID Order_Item_ID Product_ID Order_Quantity Other_Item_Details 1 128 1 5 396 2 None 2 162 4 6 191 6 Good quality
cre_Drama_Workshop_Groups
What are the planned delivery date and actual delivery date for each booking?
SELECT Planned_Delivery_Date , Actual_Delivery_Date FROM BOOKINGS
CREATE TABLE Ref_Payment_Methods ( payment_method_code CHAR(10) NOT NULL, payment_method_description VARCHAR(80), PRIMARY KEY (payment_method_code), UNIQUE (payment_method_code) ) 3 rows from Ref_Payment_Methods table: payment_method_code payment_method_description American E credit MasterCard debit Visa Visa CREATE TABLE Ref_Service_Types ( Service_Type_Code CHAR(15) NOT NULL, Parent_Service_Type_Code CHAR(15), Service_Type_Description VARCHAR(255), PRIMARY KEY (Service_Type_Code), UNIQUE (Service_Type_Code) ) 3 rows from Ref_Service_Types table: Service_Type_Code Parent_Service_Type_Code Service_Type_Description 1 1 provide photo service 2 1 provide dinning service 3 1 provide filming service CREATE TABLE Addresses ( Address_ID VARCHAR(100) NOT NULL, Line_1 VARCHAR(255), Line_2 VARCHAR(255), City_Town VARCHAR(255), State_County VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Address_ID), UNIQUE (Address_ID) ) 3 rows from Addresses table: Address_ID Line_1 Line_2 City_Town State_County Other_Details 110 4753 Dach Highway Suite 846 Feliciaberg Florida None 124 391 Vandervort Fall Apt. 446 Apt. 107 West Sherwoodstad Indiana None 148 809 Izabella Islands Suite 271 Schadenville Ohio None CREATE TABLE Products ( Product_ID VARCHAR(100) NOT NULL, Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Product_Description VARCHAR(255), Other_Product_Service_Details VARCHAR(255), PRIMARY KEY (Product_ID), UNIQUE (Product_ID) ) 3 rows from Products table: Product_ID Product_Name Product_Price Product_Description Other_Product_Service_Details 11 photo 4448536 None None 154 film 2302 None None 156 film 17622723 None None CREATE TABLE Marketing_Regions ( Marketing_Region_Code CHAR(15) NOT NULL, Marketing_Region_Name VARCHAR(255) NOT NULL, Marketing_Region_Descriptrion VARCHAR(255) NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Marketing_Region_Code), UNIQUE (Marketing_Region_Code) ) 3 rows from Marketing_Regions table: Marketing_Region_Code Marketing_Region_Name Marketing_Region_Descriptrion Other_Details CA Canada Our target market None CN China Our largest market None ES Spain None CREATE TABLE Clients ( Client_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Customer_Email_Address VARCHAR(255), Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Client_ID), UNIQUE (Client_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Clients table: Client_ID Address_ID Customer_Email_Address Customer_Name Customer_Phone Other_Details 423 201 branson94@example.net Clifford (042)912-3404x5135 VIP 426 383 alba04@example.com Bettye (604)849-0214 None 478 15 westley30@example.net Reinhold 1-048-214-4640x64380 None CREATE TABLE Drama_Workshop_Groups ( Workshop_Group_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Currency_Code CHAR(15) NOT NULL, Marketing_Region_Code CHAR(15) NOT NULL, Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Workshop_Group_ID), UNIQUE (Workshop_Group_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Drama_Workshop_Groups table: Workshop_Group_ID Address_ID Currency_Code Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 136 383 EU FR Amely Cafe 122-084-8029 amely.ruecker@example.com None 140 180 EU DE Veda Film 793-966-9311x5303 breitenberg.veda@example.com None 176 286 EU RU Queen Art 492-463-5967 quigley.queen@example.org Good CREATE TABLE Performers ( Performer_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Performer_ID), UNIQUE (Performer_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Performers table: Performer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 153 124 Shawna 664.495.1939 krogahn@example.com None 211 124 Ashley 893-536-8857 preston45@example.net None 313 39 Oren 1-952-052-6685x28082 ferry.carolina@example.net None CREATE TABLE Customers ( Customer_ID VARCHAR(100) NOT NULL, Address_ID INTEGER NOT NULL, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Customer_ID), UNIQUE (Customer_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Customers table: Customer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 240 286 Harold 624-096-7791 jerde.harmon@example.com None 267 98 Federico 914-915-7483 johnson27@example.com None 304 369 Samson 1-463-121-4086x655 dalton75@example.com None CREATE TABLE Stores ( Store_ID VARCHAR(100) NOT NULL, Address_ID INTEGER NOT NULL, Marketing_Region_Code CHAR(15) NOT NULL, Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Store_ID), UNIQUE (Store_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID), FOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code) ) 3 rows from Stores table: Store_ID Address_ID Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 150 286 IN FJA Filming +65(1)3590790358 fjacobson@example.com None 229 266 CA Rob Dinning 1-327-185-9368 rborer@example.org 5 stars 231 230 ES Adan Dinning 896-931-9633x869 adan93@example.com None CREATE TABLE Bookings ( Booking_ID INTEGER NOT NULL , Customer_ID INTEGER NOT NULL, Workshop_Group_ID VARCHAR(100) NOT NULL, Status_Code CHAR(15) NOT NULL, Store_ID INTEGER NOT NULL, Order_Date DATETIME NOT NULL, Planned_Delivery_Date DATETIME NOT NULL, Actual_Delivery_Date DATETIME NOT NULL, Other_Order_Details VARCHAR(255), PRIMARY KEY (Booking_ID), UNIQUE (Booking_ID), FOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID), FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID) ) 3 rows from Bookings table: Booking_ID Customer_ID Workshop_Group_ID Status_Code Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 938 140 good 8 2016-12-12 10:43:01 2013-03-10 18:47:05 1997-11-21 10:07:40 None 2 868 838 stop 7 1976-08-20 00:33:08 2009-07-09 09:18:38 1976-01-08 07:19:23 None 3 735 176 good 9 1975-11-23 06:28:47 1989-01-05 19:24:45 1990-03-16 19:38:47 None CREATE TABLE Performers_in_Bookings ( Order_ID INTEGER NOT NULL, Performer_ID INTEGER NOT NULL, PRIMARY KEY (Order_ID, Performer_ID), FOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID) ) 3 rows from Performers_in_Bookings table: Order_ID Performer_ID 1 153 1 341 2 466 CREATE TABLE Customer_Orders ( Order_ID INTEGER NOT NULL , Customer_ID INTEGER NOT NULL, Store_ID INTEGER NOT NULL, Order_Date DATETIME NOT NULL, Planned_Delivery_Date DATETIME NOT NULL, Actual_Delivery_Date DATETIME NOT NULL, Other_Order_Details VARCHAR(255), PRIMARY KEY (Order_ID), UNIQUE (Order_ID), FOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID), FOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID) ) 3 rows from Customer_Orders table: Order_ID Customer_ID Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 516 231 1994-08-03 12:34:58 1977-03-11 03:58:19 1992-07-21 22:11:11 None 2 418 229 2014-07-10 10:56:01 1996-08-26 19:19:59 1998-08-22 17:57:32 None 3 712 229 1981-06-20 16:29:43 1980-12-19 05:49:35 2011-04-13 07:15:35 None CREATE TABLE Order_Items ( Order_Item_ID INTEGER NOT NULL , Order_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), PRIMARY KEY (Order_Item_ID), FOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID), FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID) ) 3 rows from Order_Items table: Order_Item_ID Order_ID Product_ID Order_Quantity Other_Item_Details 1 3 233 1 None 2 15 300 2 None 3 12 300 1 None CREATE TABLE Invoices ( Invoice_ID INTEGER NOT NULL, Order_ID INTEGER NOT NULL, payment_method_code CHAR(15), Product_ID INTEGER NOT NULL, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), Order_Item_ID INTEGER NOT NULL, PRIMARY KEY (Invoice_ID), FOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID), FOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code) ) 3 rows from Invoices table: Invoice_ID Order_ID payment_method_code Product_ID Order_Quantity Other_Item_Details Order_Item_ID 128 14 MasterCard 4 2 None 1 162 13 MasterCard 9 2 None 9 164 7 Visa 7 2 None 1 CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR(15), Workshop_Group_ID INTEGER NOT NULL, Product_Description VARCHAR(255), Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Other_Product_Service_Details VARCHAR(255), PRIMARY KEY (Service_ID), UNIQUE (Service_ID), FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID), FOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code) ) 3 rows from Services table: Service_ID Service_Type_Code Workshop_Group_ID Product_Description Product_Name Product_Price Other_Product_Service_Details 191 1 415 None film 5.893278e+07 None 219 2 838 None film 2.704472e+03 None 220 1 708 None dinning 6.888831e+03 None CREATE TABLE Bookings_Services ( Order_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, PRIMARY KEY (Order_ID, Product_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID), FOREIGN KEY (Product_ID) REFERENCES Services (Service_ID) ) 3 rows from Bookings_Services table: Order_ID Product_ID 1 396 1 779 4 191 CREATE TABLE Invoice_Items ( Invoice_Item_ID INTEGER NOT NULL , Invoice_ID INTEGER NOT NULL, Order_ID INTEGER NOT NULL, Order_Item_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, Order_Quantity INTEGER, Other_Item_Details VARCHAR(255), PRIMARY KEY (Invoice_Item_ID), FOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID), FOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID), FOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID) ) 3 rows from Invoice_Items table: Invoice_Item_ID Invoice_ID Order_ID Order_Item_ID Product_ID Order_Quantity Other_Item_Details 1 128 1 5 396 2 None 2 162 4 6 191 6 Good quality
cre_Drama_Workshop_Groups
How many customers do we have?
SELECT count(*) FROM CUSTOMERS
CREATE TABLE Ref_Payment_Methods ( payment_method_code CHAR(10) NOT NULL, payment_method_description VARCHAR(80), PRIMARY KEY (payment_method_code), UNIQUE (payment_method_code) ) 3 rows from Ref_Payment_Methods table: payment_method_code payment_method_description American E credit MasterCard debit Visa Visa CREATE TABLE Ref_Service_Types ( Service_Type_Code CHAR(15) NOT NULL, Parent_Service_Type_Code CHAR(15), Service_Type_Description VARCHAR(255), PRIMARY KEY (Service_Type_Code), UNIQUE (Service_Type_Code) ) 3 rows from Ref_Service_Types table: Service_Type_Code Parent_Service_Type_Code Service_Type_Description 1 1 provide photo service 2 1 provide dinning service 3 1 provide filming service CREATE TABLE Addresses ( Address_ID VARCHAR(100) NOT NULL, Line_1 VARCHAR(255), Line_2 VARCHAR(255), City_Town VARCHAR(255), State_County VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Address_ID), UNIQUE (Address_ID) ) 3 rows from Addresses table: Address_ID Line_1 Line_2 City_Town State_County Other_Details 110 4753 Dach Highway Suite 846 Feliciaberg Florida None 124 391 Vandervort Fall Apt. 446 Apt. 107 West Sherwoodstad Indiana None 148 809 Izabella Islands Suite 271 Schadenville Ohio None CREATE TABLE Products ( Product_ID VARCHAR(100) NOT NULL, Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Product_Description VARCHAR(255), Other_Product_Service_Details VARCHAR(255), PRIMARY KEY (Product_ID), UNIQUE (Product_ID) ) 3 rows from Products table: Product_ID Product_Name Product_Price Product_Description Other_Product_Service_Details 11 photo 4448536 None None 154 film 2302 None None 156 film 17622723 None None CREATE TABLE Marketing_Regions ( Marketing_Region_Code CHAR(15) NOT NULL, Marketing_Region_Name VARCHAR(255) NOT NULL, Marketing_Region_Descriptrion VARCHAR(255) NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Marketing_Region_Code), UNIQUE (Marketing_Region_Code) ) 3 rows from Marketing_Regions table: Marketing_Region_Code Marketing_Region_Name Marketing_Region_Descriptrion Other_Details CA Canada Our target market None CN China Our largest market None ES Spain None CREATE TABLE Clients ( Client_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Customer_Email_Address VARCHAR(255), Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Client_ID), UNIQUE (Client_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Clients table: Client_ID Address_ID Customer_Email_Address Customer_Name Customer_Phone Other_Details 423 201 branson94@example.net Clifford (042)912-3404x5135 VIP 426 383 alba04@example.com Bettye (604)849-0214 None 478 15 westley30@example.net Reinhold 1-048-214-4640x64380 None CREATE TABLE Drama_Workshop_Groups ( Workshop_Group_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Currency_Code CHAR(15) NOT NULL, Marketing_Region_Code CHAR(15) NOT NULL, Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Workshop_Group_ID), UNIQUE (Workshop_Group_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Drama_Workshop_Groups table: Workshop_Group_ID Address_ID Currency_Code Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 136 383 EU FR Amely Cafe 122-084-8029 amely.ruecker@example.com None 140 180 EU DE Veda Film 793-966-9311x5303 breitenberg.veda@example.com None 176 286 EU RU Queen Art 492-463-5967 quigley.queen@example.org Good CREATE TABLE Performers ( Performer_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Performer_ID), UNIQUE (Performer_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Performers table: Performer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 153 124 Shawna 664.495.1939 krogahn@example.com None 211 124 Ashley 893-536-8857 preston45@example.net None 313 39 Oren 1-952-052-6685x28082 ferry.carolina@example.net None CREATE TABLE Customers ( Customer_ID VARCHAR(100) NOT NULL, Address_ID INTEGER NOT NULL, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Customer_ID), UNIQUE (Customer_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Customers table: Customer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 240 286 Harold 624-096-7791 jerde.harmon@example.com None 267 98 Federico 914-915-7483 johnson27@example.com None 304 369 Samson 1-463-121-4086x655 dalton75@example.com None CREATE TABLE Stores ( Store_ID VARCHAR(100) NOT NULL, Address_ID INTEGER NOT NULL, Marketing_Region_Code CHAR(15) NOT NULL, Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Store_ID), UNIQUE (Store_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID), FOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code) ) 3 rows from Stores table: Store_ID Address_ID Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 150 286 IN FJA Filming +65(1)3590790358 fjacobson@example.com None 229 266 CA Rob Dinning 1-327-185-9368 rborer@example.org 5 stars 231 230 ES Adan Dinning 896-931-9633x869 adan93@example.com None CREATE TABLE Bookings ( Booking_ID INTEGER NOT NULL , Customer_ID INTEGER NOT NULL, Workshop_Group_ID VARCHAR(100) NOT NULL, Status_Code CHAR(15) NOT NULL, Store_ID INTEGER NOT NULL, Order_Date DATETIME NOT NULL, Planned_Delivery_Date DATETIME NOT NULL, Actual_Delivery_Date DATETIME NOT NULL, Other_Order_Details VARCHAR(255), PRIMARY KEY (Booking_ID), UNIQUE (Booking_ID), FOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID), FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID) ) 3 rows from Bookings table: Booking_ID Customer_ID Workshop_Group_ID Status_Code Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 938 140 good 8 2016-12-12 10:43:01 2013-03-10 18:47:05 1997-11-21 10:07:40 None 2 868 838 stop 7 1976-08-20 00:33:08 2009-07-09 09:18:38 1976-01-08 07:19:23 None 3 735 176 good 9 1975-11-23 06:28:47 1989-01-05 19:24:45 1990-03-16 19:38:47 None CREATE TABLE Performers_in_Bookings ( Order_ID INTEGER NOT NULL, Performer_ID INTEGER NOT NULL, PRIMARY KEY (Order_ID, Performer_ID), FOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID) ) 3 rows from Performers_in_Bookings table: Order_ID Performer_ID 1 153 1 341 2 466 CREATE TABLE Customer_Orders ( Order_ID INTEGER NOT NULL , Customer_ID INTEGER NOT NULL, Store_ID INTEGER NOT NULL, Order_Date DATETIME NOT NULL, Planned_Delivery_Date DATETIME NOT NULL, Actual_Delivery_Date DATETIME NOT NULL, Other_Order_Details VARCHAR(255), PRIMARY KEY (Order_ID), UNIQUE (Order_ID), FOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID), FOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID) ) 3 rows from Customer_Orders table: Order_ID Customer_ID Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 516 231 1994-08-03 12:34:58 1977-03-11 03:58:19 1992-07-21 22:11:11 None 2 418 229 2014-07-10 10:56:01 1996-08-26 19:19:59 1998-08-22 17:57:32 None 3 712 229 1981-06-20 16:29:43 1980-12-19 05:49:35 2011-04-13 07:15:35 None CREATE TABLE Order_Items ( Order_Item_ID INTEGER NOT NULL , Order_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), PRIMARY KEY (Order_Item_ID), FOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID), FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID) ) 3 rows from Order_Items table: Order_Item_ID Order_ID Product_ID Order_Quantity Other_Item_Details 1 3 233 1 None 2 15 300 2 None 3 12 300 1 None CREATE TABLE Invoices ( Invoice_ID INTEGER NOT NULL, Order_ID INTEGER NOT NULL, payment_method_code CHAR(15), Product_ID INTEGER NOT NULL, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), Order_Item_ID INTEGER NOT NULL, PRIMARY KEY (Invoice_ID), FOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID), FOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code) ) 3 rows from Invoices table: Invoice_ID Order_ID payment_method_code Product_ID Order_Quantity Other_Item_Details Order_Item_ID 128 14 MasterCard 4 2 None 1 162 13 MasterCard 9 2 None 9 164 7 Visa 7 2 None 1 CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR(15), Workshop_Group_ID INTEGER NOT NULL, Product_Description VARCHAR(255), Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Other_Product_Service_Details VARCHAR(255), PRIMARY KEY (Service_ID), UNIQUE (Service_ID), FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID), FOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code) ) 3 rows from Services table: Service_ID Service_Type_Code Workshop_Group_ID Product_Description Product_Name Product_Price Other_Product_Service_Details 191 1 415 None film 5.893278e+07 None 219 2 838 None film 2.704472e+03 None 220 1 708 None dinning 6.888831e+03 None CREATE TABLE Bookings_Services ( Order_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, PRIMARY KEY (Order_ID, Product_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID), FOREIGN KEY (Product_ID) REFERENCES Services (Service_ID) ) 3 rows from Bookings_Services table: Order_ID Product_ID 1 396 1 779 4 191 CREATE TABLE Invoice_Items ( Invoice_Item_ID INTEGER NOT NULL , Invoice_ID INTEGER NOT NULL, Order_ID INTEGER NOT NULL, Order_Item_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, Order_Quantity INTEGER, Other_Item_Details VARCHAR(255), PRIMARY KEY (Invoice_Item_ID), FOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID), FOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID), FOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID) ) 3 rows from Invoice_Items table: Invoice_Item_ID Invoice_ID Order_ID Order_Item_ID Product_ID Order_Quantity Other_Item_Details 1 128 1 5 396 2 None 2 162 4 6 191 6 Good quality
cre_Drama_Workshop_Groups
Count the number of customers recorded.
SELECT count(*) FROM CUSTOMERS
CREATE TABLE Ref_Payment_Methods ( payment_method_code CHAR(10) NOT NULL, payment_method_description VARCHAR(80), PRIMARY KEY (payment_method_code), UNIQUE (payment_method_code) ) 3 rows from Ref_Payment_Methods table: payment_method_code payment_method_description American E credit MasterCard debit Visa Visa CREATE TABLE Ref_Service_Types ( Service_Type_Code CHAR(15) NOT NULL, Parent_Service_Type_Code CHAR(15), Service_Type_Description VARCHAR(255), PRIMARY KEY (Service_Type_Code), UNIQUE (Service_Type_Code) ) 3 rows from Ref_Service_Types table: Service_Type_Code Parent_Service_Type_Code Service_Type_Description 1 1 provide photo service 2 1 provide dinning service 3 1 provide filming service CREATE TABLE Addresses ( Address_ID VARCHAR(100) NOT NULL, Line_1 VARCHAR(255), Line_2 VARCHAR(255), City_Town VARCHAR(255), State_County VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Address_ID), UNIQUE (Address_ID) ) 3 rows from Addresses table: Address_ID Line_1 Line_2 City_Town State_County Other_Details 110 4753 Dach Highway Suite 846 Feliciaberg Florida None 124 391 Vandervort Fall Apt. 446 Apt. 107 West Sherwoodstad Indiana None 148 809 Izabella Islands Suite 271 Schadenville Ohio None CREATE TABLE Products ( Product_ID VARCHAR(100) NOT NULL, Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Product_Description VARCHAR(255), Other_Product_Service_Details VARCHAR(255), PRIMARY KEY (Product_ID), UNIQUE (Product_ID) ) 3 rows from Products table: Product_ID Product_Name Product_Price Product_Description Other_Product_Service_Details 11 photo 4448536 None None 154 film 2302 None None 156 film 17622723 None None CREATE TABLE Marketing_Regions ( Marketing_Region_Code CHAR(15) NOT NULL, Marketing_Region_Name VARCHAR(255) NOT NULL, Marketing_Region_Descriptrion VARCHAR(255) NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Marketing_Region_Code), UNIQUE (Marketing_Region_Code) ) 3 rows from Marketing_Regions table: Marketing_Region_Code Marketing_Region_Name Marketing_Region_Descriptrion Other_Details CA Canada Our target market None CN China Our largest market None ES Spain None CREATE TABLE Clients ( Client_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Customer_Email_Address VARCHAR(255), Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Client_ID), UNIQUE (Client_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Clients table: Client_ID Address_ID Customer_Email_Address Customer_Name Customer_Phone Other_Details 423 201 branson94@example.net Clifford (042)912-3404x5135 VIP 426 383 alba04@example.com Bettye (604)849-0214 None 478 15 westley30@example.net Reinhold 1-048-214-4640x64380 None CREATE TABLE Drama_Workshop_Groups ( Workshop_Group_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Currency_Code CHAR(15) NOT NULL, Marketing_Region_Code CHAR(15) NOT NULL, Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Workshop_Group_ID), UNIQUE (Workshop_Group_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Drama_Workshop_Groups table: Workshop_Group_ID Address_ID Currency_Code Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 136 383 EU FR Amely Cafe 122-084-8029 amely.ruecker@example.com None 140 180 EU DE Veda Film 793-966-9311x5303 breitenberg.veda@example.com None 176 286 EU RU Queen Art 492-463-5967 quigley.queen@example.org Good CREATE TABLE Performers ( Performer_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Performer_ID), UNIQUE (Performer_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Performers table: Performer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 153 124 Shawna 664.495.1939 krogahn@example.com None 211 124 Ashley 893-536-8857 preston45@example.net None 313 39 Oren 1-952-052-6685x28082 ferry.carolina@example.net None CREATE TABLE Customers ( Customer_ID VARCHAR(100) NOT NULL, Address_ID INTEGER NOT NULL, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Customer_ID), UNIQUE (Customer_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Customers table: Customer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 240 286 Harold 624-096-7791 jerde.harmon@example.com None 267 98 Federico 914-915-7483 johnson27@example.com None 304 369 Samson 1-463-121-4086x655 dalton75@example.com None CREATE TABLE Stores ( Store_ID VARCHAR(100) NOT NULL, Address_ID INTEGER NOT NULL, Marketing_Region_Code CHAR(15) NOT NULL, Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Store_ID), UNIQUE (Store_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID), FOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code) ) 3 rows from Stores table: Store_ID Address_ID Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 150 286 IN FJA Filming +65(1)3590790358 fjacobson@example.com None 229 266 CA Rob Dinning 1-327-185-9368 rborer@example.org 5 stars 231 230 ES Adan Dinning 896-931-9633x869 adan93@example.com None CREATE TABLE Bookings ( Booking_ID INTEGER NOT NULL , Customer_ID INTEGER NOT NULL, Workshop_Group_ID VARCHAR(100) NOT NULL, Status_Code CHAR(15) NOT NULL, Store_ID INTEGER NOT NULL, Order_Date DATETIME NOT NULL, Planned_Delivery_Date DATETIME NOT NULL, Actual_Delivery_Date DATETIME NOT NULL, Other_Order_Details VARCHAR(255), PRIMARY KEY (Booking_ID), UNIQUE (Booking_ID), FOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID), FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID) ) 3 rows from Bookings table: Booking_ID Customer_ID Workshop_Group_ID Status_Code Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 938 140 good 8 2016-12-12 10:43:01 2013-03-10 18:47:05 1997-11-21 10:07:40 None 2 868 838 stop 7 1976-08-20 00:33:08 2009-07-09 09:18:38 1976-01-08 07:19:23 None 3 735 176 good 9 1975-11-23 06:28:47 1989-01-05 19:24:45 1990-03-16 19:38:47 None CREATE TABLE Performers_in_Bookings ( Order_ID INTEGER NOT NULL, Performer_ID INTEGER NOT NULL, PRIMARY KEY (Order_ID, Performer_ID), FOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID) ) 3 rows from Performers_in_Bookings table: Order_ID Performer_ID 1 153 1 341 2 466 CREATE TABLE Customer_Orders ( Order_ID INTEGER NOT NULL , Customer_ID INTEGER NOT NULL, Store_ID INTEGER NOT NULL, Order_Date DATETIME NOT NULL, Planned_Delivery_Date DATETIME NOT NULL, Actual_Delivery_Date DATETIME NOT NULL, Other_Order_Details VARCHAR(255), PRIMARY KEY (Order_ID), UNIQUE (Order_ID), FOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID), FOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID) ) 3 rows from Customer_Orders table: Order_ID Customer_ID Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 516 231 1994-08-03 12:34:58 1977-03-11 03:58:19 1992-07-21 22:11:11 None 2 418 229 2014-07-10 10:56:01 1996-08-26 19:19:59 1998-08-22 17:57:32 None 3 712 229 1981-06-20 16:29:43 1980-12-19 05:49:35 2011-04-13 07:15:35 None CREATE TABLE Order_Items ( Order_Item_ID INTEGER NOT NULL , Order_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), PRIMARY KEY (Order_Item_ID), FOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID), FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID) ) 3 rows from Order_Items table: Order_Item_ID Order_ID Product_ID Order_Quantity Other_Item_Details 1 3 233 1 None 2 15 300 2 None 3 12 300 1 None CREATE TABLE Invoices ( Invoice_ID INTEGER NOT NULL, Order_ID INTEGER NOT NULL, payment_method_code CHAR(15), Product_ID INTEGER NOT NULL, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), Order_Item_ID INTEGER NOT NULL, PRIMARY KEY (Invoice_ID), FOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID), FOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code) ) 3 rows from Invoices table: Invoice_ID Order_ID payment_method_code Product_ID Order_Quantity Other_Item_Details Order_Item_ID 128 14 MasterCard 4 2 None 1 162 13 MasterCard 9 2 None 9 164 7 Visa 7 2 None 1 CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR(15), Workshop_Group_ID INTEGER NOT NULL, Product_Description VARCHAR(255), Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Other_Product_Service_Details VARCHAR(255), PRIMARY KEY (Service_ID), UNIQUE (Service_ID), FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID), FOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code) ) 3 rows from Services table: Service_ID Service_Type_Code Workshop_Group_ID Product_Description Product_Name Product_Price Other_Product_Service_Details 191 1 415 None film 5.893278e+07 None 219 2 838 None film 2.704472e+03 None 220 1 708 None dinning 6.888831e+03 None CREATE TABLE Bookings_Services ( Order_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, PRIMARY KEY (Order_ID, Product_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID), FOREIGN KEY (Product_ID) REFERENCES Services (Service_ID) ) 3 rows from Bookings_Services table: Order_ID Product_ID 1 396 1 779 4 191 CREATE TABLE Invoice_Items ( Invoice_Item_ID INTEGER NOT NULL , Invoice_ID INTEGER NOT NULL, Order_ID INTEGER NOT NULL, Order_Item_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, Order_Quantity INTEGER, Other_Item_Details VARCHAR(255), PRIMARY KEY (Invoice_Item_ID), FOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID), FOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID), FOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID) ) 3 rows from Invoice_Items table: Invoice_Item_ID Invoice_ID Order_ID Order_Item_ID Product_ID Order_Quantity Other_Item_Details 1 128 1 5 396 2 None 2 162 4 6 191 6 Good quality
cre_Drama_Workshop_Groups
What are the phone and email for customer Harold?
SELECT Customer_Phone , Customer_Email_Address FROM CUSTOMERS WHERE Customer_Name = "Harold"
CREATE TABLE Ref_Payment_Methods ( payment_method_code CHAR(10) NOT NULL, payment_method_description VARCHAR(80), PRIMARY KEY (payment_method_code), UNIQUE (payment_method_code) ) 3 rows from Ref_Payment_Methods table: payment_method_code payment_method_description American E credit MasterCard debit Visa Visa CREATE TABLE Ref_Service_Types ( Service_Type_Code CHAR(15) NOT NULL, Parent_Service_Type_Code CHAR(15), Service_Type_Description VARCHAR(255), PRIMARY KEY (Service_Type_Code), UNIQUE (Service_Type_Code) ) 3 rows from Ref_Service_Types table: Service_Type_Code Parent_Service_Type_Code Service_Type_Description 1 1 provide photo service 2 1 provide dinning service 3 1 provide filming service CREATE TABLE Addresses ( Address_ID VARCHAR(100) NOT NULL, Line_1 VARCHAR(255), Line_2 VARCHAR(255), City_Town VARCHAR(255), State_County VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Address_ID), UNIQUE (Address_ID) ) 3 rows from Addresses table: Address_ID Line_1 Line_2 City_Town State_County Other_Details 110 4753 Dach Highway Suite 846 Feliciaberg Florida None 124 391 Vandervort Fall Apt. 446 Apt. 107 West Sherwoodstad Indiana None 148 809 Izabella Islands Suite 271 Schadenville Ohio None CREATE TABLE Products ( Product_ID VARCHAR(100) NOT NULL, Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Product_Description VARCHAR(255), Other_Product_Service_Details VARCHAR(255), PRIMARY KEY (Product_ID), UNIQUE (Product_ID) ) 3 rows from Products table: Product_ID Product_Name Product_Price Product_Description Other_Product_Service_Details 11 photo 4448536 None None 154 film 2302 None None 156 film 17622723 None None CREATE TABLE Marketing_Regions ( Marketing_Region_Code CHAR(15) NOT NULL, Marketing_Region_Name VARCHAR(255) NOT NULL, Marketing_Region_Descriptrion VARCHAR(255) NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Marketing_Region_Code), UNIQUE (Marketing_Region_Code) ) 3 rows from Marketing_Regions table: Marketing_Region_Code Marketing_Region_Name Marketing_Region_Descriptrion Other_Details CA Canada Our target market None CN China Our largest market None ES Spain None CREATE TABLE Clients ( Client_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Customer_Email_Address VARCHAR(255), Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Client_ID), UNIQUE (Client_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Clients table: Client_ID Address_ID Customer_Email_Address Customer_Name Customer_Phone Other_Details 423 201 branson94@example.net Clifford (042)912-3404x5135 VIP 426 383 alba04@example.com Bettye (604)849-0214 None 478 15 westley30@example.net Reinhold 1-048-214-4640x64380 None CREATE TABLE Drama_Workshop_Groups ( Workshop_Group_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Currency_Code CHAR(15) NOT NULL, Marketing_Region_Code CHAR(15) NOT NULL, Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Workshop_Group_ID), UNIQUE (Workshop_Group_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Drama_Workshop_Groups table: Workshop_Group_ID Address_ID Currency_Code Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 136 383 EU FR Amely Cafe 122-084-8029 amely.ruecker@example.com None 140 180 EU DE Veda Film 793-966-9311x5303 breitenberg.veda@example.com None 176 286 EU RU Queen Art 492-463-5967 quigley.queen@example.org Good CREATE TABLE Performers ( Performer_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Performer_ID), UNIQUE (Performer_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Performers table: Performer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 153 124 Shawna 664.495.1939 krogahn@example.com None 211 124 Ashley 893-536-8857 preston45@example.net None 313 39 Oren 1-952-052-6685x28082 ferry.carolina@example.net None CREATE TABLE Customers ( Customer_ID VARCHAR(100) NOT NULL, Address_ID INTEGER NOT NULL, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Customer_ID), UNIQUE (Customer_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Customers table: Customer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 240 286 Harold 624-096-7791 jerde.harmon@example.com None 267 98 Federico 914-915-7483 johnson27@example.com None 304 369 Samson 1-463-121-4086x655 dalton75@example.com None CREATE TABLE Stores ( Store_ID VARCHAR(100) NOT NULL, Address_ID INTEGER NOT NULL, Marketing_Region_Code CHAR(15) NOT NULL, Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Store_ID), UNIQUE (Store_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID), FOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code) ) 3 rows from Stores table: Store_ID Address_ID Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 150 286 IN FJA Filming +65(1)3590790358 fjacobson@example.com None 229 266 CA Rob Dinning 1-327-185-9368 rborer@example.org 5 stars 231 230 ES Adan Dinning 896-931-9633x869 adan93@example.com None CREATE TABLE Bookings ( Booking_ID INTEGER NOT NULL , Customer_ID INTEGER NOT NULL, Workshop_Group_ID VARCHAR(100) NOT NULL, Status_Code CHAR(15) NOT NULL, Store_ID INTEGER NOT NULL, Order_Date DATETIME NOT NULL, Planned_Delivery_Date DATETIME NOT NULL, Actual_Delivery_Date DATETIME NOT NULL, Other_Order_Details VARCHAR(255), PRIMARY KEY (Booking_ID), UNIQUE (Booking_ID), FOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID), FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID) ) 3 rows from Bookings table: Booking_ID Customer_ID Workshop_Group_ID Status_Code Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 938 140 good 8 2016-12-12 10:43:01 2013-03-10 18:47:05 1997-11-21 10:07:40 None 2 868 838 stop 7 1976-08-20 00:33:08 2009-07-09 09:18:38 1976-01-08 07:19:23 None 3 735 176 good 9 1975-11-23 06:28:47 1989-01-05 19:24:45 1990-03-16 19:38:47 None CREATE TABLE Performers_in_Bookings ( Order_ID INTEGER NOT NULL, Performer_ID INTEGER NOT NULL, PRIMARY KEY (Order_ID, Performer_ID), FOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID) ) 3 rows from Performers_in_Bookings table: Order_ID Performer_ID 1 153 1 341 2 466 CREATE TABLE Customer_Orders ( Order_ID INTEGER NOT NULL , Customer_ID INTEGER NOT NULL, Store_ID INTEGER NOT NULL, Order_Date DATETIME NOT NULL, Planned_Delivery_Date DATETIME NOT NULL, Actual_Delivery_Date DATETIME NOT NULL, Other_Order_Details VARCHAR(255), PRIMARY KEY (Order_ID), UNIQUE (Order_ID), FOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID), FOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID) ) 3 rows from Customer_Orders table: Order_ID Customer_ID Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 516 231 1994-08-03 12:34:58 1977-03-11 03:58:19 1992-07-21 22:11:11 None 2 418 229 2014-07-10 10:56:01 1996-08-26 19:19:59 1998-08-22 17:57:32 None 3 712 229 1981-06-20 16:29:43 1980-12-19 05:49:35 2011-04-13 07:15:35 None CREATE TABLE Order_Items ( Order_Item_ID INTEGER NOT NULL , Order_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), PRIMARY KEY (Order_Item_ID), FOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID), FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID) ) 3 rows from Order_Items table: Order_Item_ID Order_ID Product_ID Order_Quantity Other_Item_Details 1 3 233 1 None 2 15 300 2 None 3 12 300 1 None CREATE TABLE Invoices ( Invoice_ID INTEGER NOT NULL, Order_ID INTEGER NOT NULL, payment_method_code CHAR(15), Product_ID INTEGER NOT NULL, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), Order_Item_ID INTEGER NOT NULL, PRIMARY KEY (Invoice_ID), FOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID), FOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code) ) 3 rows from Invoices table: Invoice_ID Order_ID payment_method_code Product_ID Order_Quantity Other_Item_Details Order_Item_ID 128 14 MasterCard 4 2 None 1 162 13 MasterCard 9 2 None 9 164 7 Visa 7 2 None 1 CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR(15), Workshop_Group_ID INTEGER NOT NULL, Product_Description VARCHAR(255), Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Other_Product_Service_Details VARCHAR(255), PRIMARY KEY (Service_ID), UNIQUE (Service_ID), FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID), FOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code) ) 3 rows from Services table: Service_ID Service_Type_Code Workshop_Group_ID Product_Description Product_Name Product_Price Other_Product_Service_Details 191 1 415 None film 5.893278e+07 None 219 2 838 None film 2.704472e+03 None 220 1 708 None dinning 6.888831e+03 None CREATE TABLE Bookings_Services ( Order_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, PRIMARY KEY (Order_ID, Product_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID), FOREIGN KEY (Product_ID) REFERENCES Services (Service_ID) ) 3 rows from Bookings_Services table: Order_ID Product_ID 1 396 1 779 4 191 CREATE TABLE Invoice_Items ( Invoice_Item_ID INTEGER NOT NULL , Invoice_ID INTEGER NOT NULL, Order_ID INTEGER NOT NULL, Order_Item_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, Order_Quantity INTEGER, Other_Item_Details VARCHAR(255), PRIMARY KEY (Invoice_Item_ID), FOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID), FOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID), FOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID) ) 3 rows from Invoice_Items table: Invoice_Item_ID Invoice_ID Order_ID Order_Item_ID Product_ID Order_Quantity Other_Item_Details 1 128 1 5 396 2 None 2 162 4 6 191 6 Good quality
cre_Drama_Workshop_Groups
Find the phone number and email address of customer "Harold".
SELECT Customer_Phone , Customer_Email_Address FROM CUSTOMERS WHERE Customer_Name = "Harold"
CREATE TABLE Ref_Payment_Methods ( payment_method_code CHAR(10) NOT NULL, payment_method_description VARCHAR(80), PRIMARY KEY (payment_method_code), UNIQUE (payment_method_code) ) 3 rows from Ref_Payment_Methods table: payment_method_code payment_method_description American E credit MasterCard debit Visa Visa CREATE TABLE Ref_Service_Types ( Service_Type_Code CHAR(15) NOT NULL, Parent_Service_Type_Code CHAR(15), Service_Type_Description VARCHAR(255), PRIMARY KEY (Service_Type_Code), UNIQUE (Service_Type_Code) ) 3 rows from Ref_Service_Types table: Service_Type_Code Parent_Service_Type_Code Service_Type_Description 1 1 provide photo service 2 1 provide dinning service 3 1 provide filming service CREATE TABLE Addresses ( Address_ID VARCHAR(100) NOT NULL, Line_1 VARCHAR(255), Line_2 VARCHAR(255), City_Town VARCHAR(255), State_County VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Address_ID), UNIQUE (Address_ID) ) 3 rows from Addresses table: Address_ID Line_1 Line_2 City_Town State_County Other_Details 110 4753 Dach Highway Suite 846 Feliciaberg Florida None 124 391 Vandervort Fall Apt. 446 Apt. 107 West Sherwoodstad Indiana None 148 809 Izabella Islands Suite 271 Schadenville Ohio None CREATE TABLE Products ( Product_ID VARCHAR(100) NOT NULL, Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Product_Description VARCHAR(255), Other_Product_Service_Details VARCHAR(255), PRIMARY KEY (Product_ID), UNIQUE (Product_ID) ) 3 rows from Products table: Product_ID Product_Name Product_Price Product_Description Other_Product_Service_Details 11 photo 4448536 None None 154 film 2302 None None 156 film 17622723 None None CREATE TABLE Marketing_Regions ( Marketing_Region_Code CHAR(15) NOT NULL, Marketing_Region_Name VARCHAR(255) NOT NULL, Marketing_Region_Descriptrion VARCHAR(255) NOT NULL, Other_Details VARCHAR(255), PRIMARY KEY (Marketing_Region_Code), UNIQUE (Marketing_Region_Code) ) 3 rows from Marketing_Regions table: Marketing_Region_Code Marketing_Region_Name Marketing_Region_Descriptrion Other_Details CA Canada Our target market None CN China Our largest market None ES Spain None CREATE TABLE Clients ( Client_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Customer_Email_Address VARCHAR(255), Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Client_ID), UNIQUE (Client_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Clients table: Client_ID Address_ID Customer_Email_Address Customer_Name Customer_Phone Other_Details 423 201 branson94@example.net Clifford (042)912-3404x5135 VIP 426 383 alba04@example.com Bettye (604)849-0214 None 478 15 westley30@example.net Reinhold 1-048-214-4640x64380 None CREATE TABLE Drama_Workshop_Groups ( Workshop_Group_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Currency_Code CHAR(15) NOT NULL, Marketing_Region_Code CHAR(15) NOT NULL, Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Workshop_Group_ID), UNIQUE (Workshop_Group_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Drama_Workshop_Groups table: Workshop_Group_ID Address_ID Currency_Code Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 136 383 EU FR Amely Cafe 122-084-8029 amely.ruecker@example.com None 140 180 EU DE Veda Film 793-966-9311x5303 breitenberg.veda@example.com None 176 286 EU RU Queen Art 492-463-5967 quigley.queen@example.org Good CREATE TABLE Performers ( Performer_ID INTEGER NOT NULL, Address_ID INTEGER NOT NULL, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Performer_ID), UNIQUE (Performer_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Performers table: Performer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 153 124 Shawna 664.495.1939 krogahn@example.com None 211 124 Ashley 893-536-8857 preston45@example.net None 313 39 Oren 1-952-052-6685x28082 ferry.carolina@example.net None CREATE TABLE Customers ( Customer_ID VARCHAR(100) NOT NULL, Address_ID INTEGER NOT NULL, Customer_Name VARCHAR(255), Customer_Phone VARCHAR(255), Customer_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Customer_ID), UNIQUE (Customer_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID) ) 3 rows from Customers table: Customer_ID Address_ID Customer_Name Customer_Phone Customer_Email_Address Other_Details 240 286 Harold 624-096-7791 jerde.harmon@example.com None 267 98 Federico 914-915-7483 johnson27@example.com None 304 369 Samson 1-463-121-4086x655 dalton75@example.com None CREATE TABLE Stores ( Store_ID VARCHAR(100) NOT NULL, Address_ID INTEGER NOT NULL, Marketing_Region_Code CHAR(15) NOT NULL, Store_Name VARCHAR(255), Store_Phone VARCHAR(255), Store_Email_Address VARCHAR(255), Other_Details VARCHAR(255), PRIMARY KEY (Store_ID), UNIQUE (Store_ID), FOREIGN KEY (Address_ID) REFERENCES Addresses (Address_ID), FOREIGN KEY (Marketing_Region_Code) REFERENCES Marketing_Regions (Marketing_Region_Code) ) 3 rows from Stores table: Store_ID Address_ID Marketing_Region_Code Store_Name Store_Phone Store_Email_Address Other_Details 150 286 IN FJA Filming +65(1)3590790358 fjacobson@example.com None 229 266 CA Rob Dinning 1-327-185-9368 rborer@example.org 5 stars 231 230 ES Adan Dinning 896-931-9633x869 adan93@example.com None CREATE TABLE Bookings ( Booking_ID INTEGER NOT NULL , Customer_ID INTEGER NOT NULL, Workshop_Group_ID VARCHAR(100) NOT NULL, Status_Code CHAR(15) NOT NULL, Store_ID INTEGER NOT NULL, Order_Date DATETIME NOT NULL, Planned_Delivery_Date DATETIME NOT NULL, Actual_Delivery_Date DATETIME NOT NULL, Other_Order_Details VARCHAR(255), PRIMARY KEY (Booking_ID), UNIQUE (Booking_ID), FOREIGN KEY (Customer_ID) REFERENCES Clients (Client_ID), FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID) ) 3 rows from Bookings table: Booking_ID Customer_ID Workshop_Group_ID Status_Code Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 938 140 good 8 2016-12-12 10:43:01 2013-03-10 18:47:05 1997-11-21 10:07:40 None 2 868 838 stop 7 1976-08-20 00:33:08 2009-07-09 09:18:38 1976-01-08 07:19:23 None 3 735 176 good 9 1975-11-23 06:28:47 1989-01-05 19:24:45 1990-03-16 19:38:47 None CREATE TABLE Performers_in_Bookings ( Order_ID INTEGER NOT NULL, Performer_ID INTEGER NOT NULL, PRIMARY KEY (Order_ID, Performer_ID), FOREIGN KEY (Performer_ID) REFERENCES Performers (Performer_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID) ) 3 rows from Performers_in_Bookings table: Order_ID Performer_ID 1 153 1 341 2 466 CREATE TABLE Customer_Orders ( Order_ID INTEGER NOT NULL , Customer_ID INTEGER NOT NULL, Store_ID INTEGER NOT NULL, Order_Date DATETIME NOT NULL, Planned_Delivery_Date DATETIME NOT NULL, Actual_Delivery_Date DATETIME NOT NULL, Other_Order_Details VARCHAR(255), PRIMARY KEY (Order_ID), UNIQUE (Order_ID), FOREIGN KEY (Customer_ID) REFERENCES Customers (Customer_ID), FOREIGN KEY (Store_ID) REFERENCES Stores (Store_ID) ) 3 rows from Customer_Orders table: Order_ID Customer_ID Store_ID Order_Date Planned_Delivery_Date Actual_Delivery_Date Other_Order_Details 1 516 231 1994-08-03 12:34:58 1977-03-11 03:58:19 1992-07-21 22:11:11 None 2 418 229 2014-07-10 10:56:01 1996-08-26 19:19:59 1998-08-22 17:57:32 None 3 712 229 1981-06-20 16:29:43 1980-12-19 05:49:35 2011-04-13 07:15:35 None CREATE TABLE Order_Items ( Order_Item_ID INTEGER NOT NULL , Order_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), PRIMARY KEY (Order_Item_ID), FOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID), FOREIGN KEY (Product_ID) REFERENCES Products (Product_ID) ) 3 rows from Order_Items table: Order_Item_ID Order_ID Product_ID Order_Quantity Other_Item_Details 1 3 233 1 None 2 15 300 2 None 3 12 300 1 None CREATE TABLE Invoices ( Invoice_ID INTEGER NOT NULL, Order_ID INTEGER NOT NULL, payment_method_code CHAR(15), Product_ID INTEGER NOT NULL, Order_Quantity VARCHAR(288), Other_Item_Details VARCHAR(255), Order_Item_ID INTEGER NOT NULL, PRIMARY KEY (Invoice_ID), FOREIGN KEY (Order_ID) REFERENCES Customer_Orders (Order_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID), FOREIGN KEY (payment_method_code) REFERENCES Ref_Payment_Methods (payment_method_code) ) 3 rows from Invoices table: Invoice_ID Order_ID payment_method_code Product_ID Order_Quantity Other_Item_Details Order_Item_ID 128 14 MasterCard 4 2 None 1 162 13 MasterCard 9 2 None 9 164 7 Visa 7 2 None 1 CREATE TABLE Services ( Service_ID INTEGER NOT NULL, Service_Type_Code CHAR(15), Workshop_Group_ID INTEGER NOT NULL, Product_Description VARCHAR(255), Product_Name VARCHAR(255), Product_Price DECIMAL(20,4), Other_Product_Service_Details VARCHAR(255), PRIMARY KEY (Service_ID), UNIQUE (Service_ID), FOREIGN KEY (Workshop_Group_ID) REFERENCES Drama_Workshop_Groups (Workshop_Group_ID), FOREIGN KEY (Service_Type_Code) REFERENCES Ref_Service_Types (Service_Type_Code) ) 3 rows from Services table: Service_ID Service_Type_Code Workshop_Group_ID Product_Description Product_Name Product_Price Other_Product_Service_Details 191 1 415 None film 5.893278e+07 None 219 2 838 None film 2.704472e+03 None 220 1 708 None dinning 6.888831e+03 None CREATE TABLE Bookings_Services ( Order_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, PRIMARY KEY (Order_ID, Product_ID), FOREIGN KEY (Order_ID) REFERENCES Bookings (Booking_ID), FOREIGN KEY (Product_ID) REFERENCES Services (Service_ID) ) 3 rows from Bookings_Services table: Order_ID Product_ID 1 396 1 779 4 191 CREATE TABLE Invoice_Items ( Invoice_Item_ID INTEGER NOT NULL , Invoice_ID INTEGER NOT NULL, Order_ID INTEGER NOT NULL, Order_Item_ID INTEGER NOT NULL, Product_ID INTEGER NOT NULL, Order_Quantity INTEGER, Other_Item_Details VARCHAR(255), PRIMARY KEY (Invoice_Item_ID), FOREIGN KEY (Order_Item_ID) REFERENCES Order_Items (Order_Item_ID), FOREIGN KEY (Invoice_ID) REFERENCES Invoices (Invoice_ID), FOREIGN KEY (Order_ID, Product_ID) REFERENCES Bookings_Services (Order_ID,Product_ID) ) 3 rows from Invoice_Items table: Invoice_Item_ID Invoice_ID Order_ID Order_Item_ID Product_ID Order_Quantity Other_Item_Details 1 128 1 5 396 2 None 2 162 4 6 191 6 Good quality