db_id stringclasses 146
values | question stringlengths 3 224 | sql stringlengths 18 577 | database_schema stringclasses 146
values |
|---|---|---|---|
company_employee | What is the maximum and minimum market value of companies? | SELECT max(Market_Value_in_Billion) , min(Market_Value_in_Billion) FROM company | CREATE TABLE "people" (
"People_ID" int,
"Age" int,
"Name" text,
"Nationality" text,
"Graduation_College" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Age Name Nationality Graduation_College
1 27 Reggie Lewis United States Northeastern
2 25 Brad Lohaus United States Iowa
3 37 Tom Sheehey United Kindom Virginia
CREATE TABLE "company" (
"Company_ID" real,
"Name" text,
"Headquarters" text,
"Industry" text,
"Sales_in_Billion" real,
"Profits_in_Billion" real,
"Assets_in_Billion" real,
"Market_Value_in_Billion" real,
PRIMARY KEY ("Company_ID")
)
3 rows from company table:
Company_ID Name Headquarters Industry Sales_in_Billion Profits_in_Billion Assets_in_Billion Market_Value_in_Billion
1.0 ExxonMobil USA Oil and gas 433.5 41.1 331.1 407.4
2.0 JPMorgan Chase USA Banking 110.8 19.0 2265.8 170.1
3.0 General Electric USA Conglomerate 147.3 14.2 717.2 213.7
CREATE TABLE "employment" (
"Company_ID" int,
"People_ID" int,
"Year_working" int,
PRIMARY KEY ("Company_ID","People_ID"),
FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)
3 rows from employment table:
Company_ID People_ID Year_working
11 3 2
13 2 3
17 7 4
|
company_employee | What is the headquarter of the company with the largest sales? | SELECT Headquarters FROM company ORDER BY Sales_in_Billion DESC LIMIT 1 | CREATE TABLE "people" (
"People_ID" int,
"Age" int,
"Name" text,
"Nationality" text,
"Graduation_College" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Age Name Nationality Graduation_College
1 27 Reggie Lewis United States Northeastern
2 25 Brad Lohaus United States Iowa
3 37 Tom Sheehey United Kindom Virginia
CREATE TABLE "company" (
"Company_ID" real,
"Name" text,
"Headquarters" text,
"Industry" text,
"Sales_in_Billion" real,
"Profits_in_Billion" real,
"Assets_in_Billion" real,
"Market_Value_in_Billion" real,
PRIMARY KEY ("Company_ID")
)
3 rows from company table:
Company_ID Name Headquarters Industry Sales_in_Billion Profits_in_Billion Assets_in_Billion Market_Value_in_Billion
1.0 ExxonMobil USA Oil and gas 433.5 41.1 331.1 407.4
2.0 JPMorgan Chase USA Banking 110.8 19.0 2265.8 170.1
3.0 General Electric USA Conglomerate 147.3 14.2 717.2 213.7
CREATE TABLE "employment" (
"Company_ID" int,
"People_ID" int,
"Year_working" int,
PRIMARY KEY ("Company_ID","People_ID"),
FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)
3 rows from employment table:
Company_ID People_ID Year_working
11 3 2
13 2 3
17 7 4
|
company_employee | Show the different headquarters and number of companies at each headquarter. | SELECT Headquarters , COUNT(*) FROM company GROUP BY Headquarters | CREATE TABLE "people" (
"People_ID" int,
"Age" int,
"Name" text,
"Nationality" text,
"Graduation_College" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Age Name Nationality Graduation_College
1 27 Reggie Lewis United States Northeastern
2 25 Brad Lohaus United States Iowa
3 37 Tom Sheehey United Kindom Virginia
CREATE TABLE "company" (
"Company_ID" real,
"Name" text,
"Headquarters" text,
"Industry" text,
"Sales_in_Billion" real,
"Profits_in_Billion" real,
"Assets_in_Billion" real,
"Market_Value_in_Billion" real,
PRIMARY KEY ("Company_ID")
)
3 rows from company table:
Company_ID Name Headquarters Industry Sales_in_Billion Profits_in_Billion Assets_in_Billion Market_Value_in_Billion
1.0 ExxonMobil USA Oil and gas 433.5 41.1 331.1 407.4
2.0 JPMorgan Chase USA Banking 110.8 19.0 2265.8 170.1
3.0 General Electric USA Conglomerate 147.3 14.2 717.2 213.7
CREATE TABLE "employment" (
"Company_ID" int,
"People_ID" int,
"Year_working" int,
PRIMARY KEY ("Company_ID","People_ID"),
FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)
3 rows from employment table:
Company_ID People_ID Year_working
11 3 2
13 2 3
17 7 4
|
company_employee | Show the most common headquarter for companies. | SELECT Headquarters FROM company GROUP BY Headquarters ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE "people" (
"People_ID" int,
"Age" int,
"Name" text,
"Nationality" text,
"Graduation_College" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Age Name Nationality Graduation_College
1 27 Reggie Lewis United States Northeastern
2 25 Brad Lohaus United States Iowa
3 37 Tom Sheehey United Kindom Virginia
CREATE TABLE "company" (
"Company_ID" real,
"Name" text,
"Headquarters" text,
"Industry" text,
"Sales_in_Billion" real,
"Profits_in_Billion" real,
"Assets_in_Billion" real,
"Market_Value_in_Billion" real,
PRIMARY KEY ("Company_ID")
)
3 rows from company table:
Company_ID Name Headquarters Industry Sales_in_Billion Profits_in_Billion Assets_in_Billion Market_Value_in_Billion
1.0 ExxonMobil USA Oil and gas 433.5 41.1 331.1 407.4
2.0 JPMorgan Chase USA Banking 110.8 19.0 2265.8 170.1
3.0 General Electric USA Conglomerate 147.3 14.2 717.2 213.7
CREATE TABLE "employment" (
"Company_ID" int,
"People_ID" int,
"Year_working" int,
PRIMARY KEY ("Company_ID","People_ID"),
FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)
3 rows from employment table:
Company_ID People_ID Year_working
11 3 2
13 2 3
17 7 4
|
company_employee | Show the headquarters that have at least two companies. | SELECT Headquarters FROM company GROUP BY Headquarters HAVING COUNT(*) >= 2 | CREATE TABLE "people" (
"People_ID" int,
"Age" int,
"Name" text,
"Nationality" text,
"Graduation_College" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Age Name Nationality Graduation_College
1 27 Reggie Lewis United States Northeastern
2 25 Brad Lohaus United States Iowa
3 37 Tom Sheehey United Kindom Virginia
CREATE TABLE "company" (
"Company_ID" real,
"Name" text,
"Headquarters" text,
"Industry" text,
"Sales_in_Billion" real,
"Profits_in_Billion" real,
"Assets_in_Billion" real,
"Market_Value_in_Billion" real,
PRIMARY KEY ("Company_ID")
)
3 rows from company table:
Company_ID Name Headquarters Industry Sales_in_Billion Profits_in_Billion Assets_in_Billion Market_Value_in_Billion
1.0 ExxonMobil USA Oil and gas 433.5 41.1 331.1 407.4
2.0 JPMorgan Chase USA Banking 110.8 19.0 2265.8 170.1
3.0 General Electric USA Conglomerate 147.3 14.2 717.2 213.7
CREATE TABLE "employment" (
"Company_ID" int,
"People_ID" int,
"Year_working" int,
PRIMARY KEY ("Company_ID","People_ID"),
FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)
3 rows from employment table:
Company_ID People_ID Year_working
11 3 2
13 2 3
17 7 4
|
company_employee | Show the headquarters that have both companies in banking industry and companies in oil and gas industry. | SELECT Headquarters FROM company WHERE Industry = "Banking" INTERSECT SELECT Headquarters FROM company WHERE Industry = "Oil and gas" | CREATE TABLE "people" (
"People_ID" int,
"Age" int,
"Name" text,
"Nationality" text,
"Graduation_College" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Age Name Nationality Graduation_College
1 27 Reggie Lewis United States Northeastern
2 25 Brad Lohaus United States Iowa
3 37 Tom Sheehey United Kindom Virginia
CREATE TABLE "company" (
"Company_ID" real,
"Name" text,
"Headquarters" text,
"Industry" text,
"Sales_in_Billion" real,
"Profits_in_Billion" real,
"Assets_in_Billion" real,
"Market_Value_in_Billion" real,
PRIMARY KEY ("Company_ID")
)
3 rows from company table:
Company_ID Name Headquarters Industry Sales_in_Billion Profits_in_Billion Assets_in_Billion Market_Value_in_Billion
1.0 ExxonMobil USA Oil and gas 433.5 41.1 331.1 407.4
2.0 JPMorgan Chase USA Banking 110.8 19.0 2265.8 170.1
3.0 General Electric USA Conglomerate 147.3 14.2 717.2 213.7
CREATE TABLE "employment" (
"Company_ID" int,
"People_ID" int,
"Year_working" int,
PRIMARY KEY ("Company_ID","People_ID"),
FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)
3 rows from employment table:
Company_ID People_ID Year_working
11 3 2
13 2 3
17 7 4
|
company_employee | Show the names of companies and of employees. | SELECT T3.Name , T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID JOIN company AS T3 ON T1.Company_ID = T3.Company_ID | CREATE TABLE "people" (
"People_ID" int,
"Age" int,
"Name" text,
"Nationality" text,
"Graduation_College" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Age Name Nationality Graduation_College
1 27 Reggie Lewis United States Northeastern
2 25 Brad Lohaus United States Iowa
3 37 Tom Sheehey United Kindom Virginia
CREATE TABLE "company" (
"Company_ID" real,
"Name" text,
"Headquarters" text,
"Industry" text,
"Sales_in_Billion" real,
"Profits_in_Billion" real,
"Assets_in_Billion" real,
"Market_Value_in_Billion" real,
PRIMARY KEY ("Company_ID")
)
3 rows from company table:
Company_ID Name Headquarters Industry Sales_in_Billion Profits_in_Billion Assets_in_Billion Market_Value_in_Billion
1.0 ExxonMobil USA Oil and gas 433.5 41.1 331.1 407.4
2.0 JPMorgan Chase USA Banking 110.8 19.0 2265.8 170.1
3.0 General Electric USA Conglomerate 147.3 14.2 717.2 213.7
CREATE TABLE "employment" (
"Company_ID" int,
"People_ID" int,
"Year_working" int,
PRIMARY KEY ("Company_ID","People_ID"),
FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)
3 rows from employment table:
Company_ID People_ID Year_working
11 3 2
13 2 3
17 7 4
|
company_employee | Show names of companies and that of employees in descending order of number of years working for that employee. | SELECT T3.Name , T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID JOIN company AS T3 ON T1.Company_ID = T3.Company_ID ORDER BY T1.Year_working | CREATE TABLE "people" (
"People_ID" int,
"Age" int,
"Name" text,
"Nationality" text,
"Graduation_College" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Age Name Nationality Graduation_College
1 27 Reggie Lewis United States Northeastern
2 25 Brad Lohaus United States Iowa
3 37 Tom Sheehey United Kindom Virginia
CREATE TABLE "company" (
"Company_ID" real,
"Name" text,
"Headquarters" text,
"Industry" text,
"Sales_in_Billion" real,
"Profits_in_Billion" real,
"Assets_in_Billion" real,
"Market_Value_in_Billion" real,
PRIMARY KEY ("Company_ID")
)
3 rows from company table:
Company_ID Name Headquarters Industry Sales_in_Billion Profits_in_Billion Assets_in_Billion Market_Value_in_Billion
1.0 ExxonMobil USA Oil and gas 433.5 41.1 331.1 407.4
2.0 JPMorgan Chase USA Banking 110.8 19.0 2265.8 170.1
3.0 General Electric USA Conglomerate 147.3 14.2 717.2 213.7
CREATE TABLE "employment" (
"Company_ID" int,
"People_ID" int,
"Year_working" int,
PRIMARY KEY ("Company_ID","People_ID"),
FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)
3 rows from employment table:
Company_ID People_ID Year_working
11 3 2
13 2 3
17 7 4
|
company_employee | Show the names of employees that work for companies with sales bigger than 200. | SELECT T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID JOIN company AS T3 ON T1.Company_ID = T3.Company_ID WHERE T3.Sales_in_Billion > 200 | CREATE TABLE "people" (
"People_ID" int,
"Age" int,
"Name" text,
"Nationality" text,
"Graduation_College" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Age Name Nationality Graduation_College
1 27 Reggie Lewis United States Northeastern
2 25 Brad Lohaus United States Iowa
3 37 Tom Sheehey United Kindom Virginia
CREATE TABLE "company" (
"Company_ID" real,
"Name" text,
"Headquarters" text,
"Industry" text,
"Sales_in_Billion" real,
"Profits_in_Billion" real,
"Assets_in_Billion" real,
"Market_Value_in_Billion" real,
PRIMARY KEY ("Company_ID")
)
3 rows from company table:
Company_ID Name Headquarters Industry Sales_in_Billion Profits_in_Billion Assets_in_Billion Market_Value_in_Billion
1.0 ExxonMobil USA Oil and gas 433.5 41.1 331.1 407.4
2.0 JPMorgan Chase USA Banking 110.8 19.0 2265.8 170.1
3.0 General Electric USA Conglomerate 147.3 14.2 717.2 213.7
CREATE TABLE "employment" (
"Company_ID" int,
"People_ID" int,
"Year_working" int,
PRIMARY KEY ("Company_ID","People_ID"),
FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)
3 rows from employment table:
Company_ID People_ID Year_working
11 3 2
13 2 3
17 7 4
|
company_employee | Show the names of companies and the number of employees they have | SELECT T3.Name , COUNT(*) FROM employment AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID JOIN company AS T3 ON T1.Company_ID = T3.Company_ID GROUP BY T3.Name | CREATE TABLE "people" (
"People_ID" int,
"Age" int,
"Name" text,
"Nationality" text,
"Graduation_College" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Age Name Nationality Graduation_College
1 27 Reggie Lewis United States Northeastern
2 25 Brad Lohaus United States Iowa
3 37 Tom Sheehey United Kindom Virginia
CREATE TABLE "company" (
"Company_ID" real,
"Name" text,
"Headquarters" text,
"Industry" text,
"Sales_in_Billion" real,
"Profits_in_Billion" real,
"Assets_in_Billion" real,
"Market_Value_in_Billion" real,
PRIMARY KEY ("Company_ID")
)
3 rows from company table:
Company_ID Name Headquarters Industry Sales_in_Billion Profits_in_Billion Assets_in_Billion Market_Value_in_Billion
1.0 ExxonMobil USA Oil and gas 433.5 41.1 331.1 407.4
2.0 JPMorgan Chase USA Banking 110.8 19.0 2265.8 170.1
3.0 General Electric USA Conglomerate 147.3 14.2 717.2 213.7
CREATE TABLE "employment" (
"Company_ID" int,
"People_ID" int,
"Year_working" int,
PRIMARY KEY ("Company_ID","People_ID"),
FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)
3 rows from employment table:
Company_ID People_ID Year_working
11 3 2
13 2 3
17 7 4
|
company_employee | List the names of people that are not employed by any company | SELECT Name FROM people WHERE People_ID NOT IN (SELECT People_ID FROM employment) | CREATE TABLE "people" (
"People_ID" int,
"Age" int,
"Name" text,
"Nationality" text,
"Graduation_College" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Age Name Nationality Graduation_College
1 27 Reggie Lewis United States Northeastern
2 25 Brad Lohaus United States Iowa
3 37 Tom Sheehey United Kindom Virginia
CREATE TABLE "company" (
"Company_ID" real,
"Name" text,
"Headquarters" text,
"Industry" text,
"Sales_in_Billion" real,
"Profits_in_Billion" real,
"Assets_in_Billion" real,
"Market_Value_in_Billion" real,
PRIMARY KEY ("Company_ID")
)
3 rows from company table:
Company_ID Name Headquarters Industry Sales_in_Billion Profits_in_Billion Assets_in_Billion Market_Value_in_Billion
1.0 ExxonMobil USA Oil and gas 433.5 41.1 331.1 407.4
2.0 JPMorgan Chase USA Banking 110.8 19.0 2265.8 170.1
3.0 General Electric USA Conglomerate 147.3 14.2 717.2 213.7
CREATE TABLE "employment" (
"Company_ID" int,
"People_ID" int,
"Year_working" int,
PRIMARY KEY ("Company_ID","People_ID"),
FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)
3 rows from employment table:
Company_ID People_ID Year_working
11 3 2
13 2 3
17 7 4
|
company_employee | list the names of the companies with more than 200 sales in the descending order of sales and profits. | SELECT name FROM company WHERE Sales_in_Billion > 200 ORDER BY Sales_in_Billion , Profits_in_Billion DESC | CREATE TABLE "people" (
"People_ID" int,
"Age" int,
"Name" text,
"Nationality" text,
"Graduation_College" text,
PRIMARY KEY ("People_ID")
)
3 rows from people table:
People_ID Age Name Nationality Graduation_College
1 27 Reggie Lewis United States Northeastern
2 25 Brad Lohaus United States Iowa
3 37 Tom Sheehey United Kindom Virginia
CREATE TABLE "company" (
"Company_ID" real,
"Name" text,
"Headquarters" text,
"Industry" text,
"Sales_in_Billion" real,
"Profits_in_Billion" real,
"Assets_in_Billion" real,
"Market_Value_in_Billion" real,
PRIMARY KEY ("Company_ID")
)
3 rows from company table:
Company_ID Name Headquarters Industry Sales_in_Billion Profits_in_Billion Assets_in_Billion Market_Value_in_Billion
1.0 ExxonMobil USA Oil and gas 433.5 41.1 331.1 407.4
2.0 JPMorgan Chase USA Banking 110.8 19.0 2265.8 170.1
3.0 General Electric USA Conglomerate 147.3 14.2 717.2 213.7
CREATE TABLE "employment" (
"Company_ID" int,
"People_ID" int,
"Year_working" int,
PRIMARY KEY ("Company_ID","People_ID"),
FOREIGN KEY ("Company_ID") REFERENCES `company`("Company_ID"),
FOREIGN KEY ("People_ID") REFERENCES `people`("People_ID")
)
3 rows from employment table:
Company_ID People_ID Year_working
11 3 2
13 2 3
17 7 4
|
film_rank | How many film are there? | SELECT count(*) FROM film | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | Count the number of films. | SELECT count(*) FROM film | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | List the distinct director of all films. | SELECT DISTINCT Director FROM film | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | What are the different film Directors? | SELECT DISTINCT Director FROM film | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | What is the average ticket sales gross in dollars of films? | SELECT avg(Gross_in_dollar) FROM film | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | Return the average gross sales in dollars across all films. | SELECT avg(Gross_in_dollar) FROM film | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | What are the low and high estimates of film markets? | SELECT Low_Estimate , High_Estimate FROM film_market_estimation | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | Return the low and high estimates for all film markets. | SELECT Low_Estimate , High_Estimate FROM film_market_estimation | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | What are the types of film market estimations in year 1995? | SELECT TYPE FROM film_market_estimation WHERE YEAR = 1995 | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | Return the types of film market estimations in 1995. | SELECT TYPE FROM film_market_estimation WHERE YEAR = 1995 | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | What are the maximum and minimum number of cities in all markets. | SELECT max(Number_cities) , min(Number_cities) FROM market | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | Return the maximum and minimum number of cities across all markets. | SELECT max(Number_cities) , min(Number_cities) FROM market | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | How many markets have number of cities smaller than 300? | SELECT count(*) FROM market WHERE Number_cities < 300 | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | Count the number of markets that have a number of cities lower than 300. | SELECT count(*) FROM market WHERE Number_cities < 300 | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | List all countries of markets in ascending alphabetical order. | SELECT Country FROM market ORDER BY Country ASC | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | What are the countries for each market, ordered alphabetically? | SELECT Country FROM market ORDER BY Country ASC | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | List all countries of markets in descending order of number of cities. | SELECT Country FROM market ORDER BY Number_cities DESC | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | What are the countries for each market ordered by decreasing number of cities? | SELECT Country FROM market ORDER BY Number_cities DESC | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | Please show the titles of films and the types of market estimations. | SELECT T1.Title , T2.Type FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | What are the titles of films and corresponding types of market estimations? | SELECT T1.Title , T2.Type FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | Show the distinct director of films with market estimation in the year of 1995. | SELECT DISTINCT T1.Director FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID WHERE T2.Year = 1995 | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | Who are the different directors of films which had market estimation in 1995? | SELECT DISTINCT T1.Director FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID WHERE T2.Year = 1995 | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | What is the average number of cities of markets with low film market estimate bigger than 10000? | SELECT avg(T2.Number_cities) FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID WHERE T1.Low_Estimate > 10000 | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | Give the average number of cities within markets that had a low market estimation larger than 10000? | SELECT avg(T2.Number_cities) FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID WHERE T1.Low_Estimate > 10000 | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | Please list the countries and years of film market estimations. | SELECT T2.Country , T1.Year FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | What are the countries of markets and their corresponding years of market estimation? | SELECT T2.Country , T1.Year FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | Please list the years of film market estimations when the market is in country "Japan" in descending order. | SELECT T1.Year FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID WHERE T2.Country = "Japan" ORDER BY T1.Year DESC | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | What are the years of film market estimation for the market of Japan, ordered by year descending? | SELECT T1.Year FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID WHERE T2.Country = "Japan" ORDER BY T1.Year DESC | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | List the studios of each film and the number of films produced by that studio. | SELECT Studio , COUNT(*) FROM film GROUP BY Studio | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | How films are produced by each studio? | SELECT Studio , COUNT(*) FROM film GROUP BY Studio | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | List the name of film studio that have the most number of films. | SELECT Studio FROM film GROUP BY Studio ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | What is the name of teh studio that created the most films? | SELECT Studio FROM film GROUP BY Studio ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | List the names of studios that have at least two films. | SELECT Studio FROM film GROUP BY Studio HAVING COUNT(*) >= 2 | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | What are the names of studios that have made two or more films? | SELECT Studio FROM film GROUP BY Studio HAVING COUNT(*) >= 2 | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | List the title of films that do not have any market estimation. | SELECT Title FROM film WHERE Film_ID NOT IN (SELECT Film_ID FROM film_market_estimation) | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | What are the titles of films that do not have a film market estimation? | SELECT Title FROM film WHERE Film_ID NOT IN (SELECT Film_ID FROM film_market_estimation) | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | Show the studios that have produced films with director "Nicholas Meyer" and "Walter Hill". | SELECT Studio FROM film WHERE Director = "Nicholas Meyer" INTERSECT SELECT Studio FROM film WHERE Director = "Walter Hill" | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | What are the names of studios that have produced films with both Nicholas Meyer and Walter Hill? | SELECT Studio FROM film WHERE Director = "Nicholas Meyer" INTERSECT SELECT Studio FROM film WHERE Director = "Walter Hill" | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | Find the titles and studios of the films that are produced by some film studios that contained the word "Universal". | SELECT title , Studio FROM film WHERE Studio LIKE "%Universal%" | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | What are the titles and studios of films that have been produced by a studio whose name contains "Universal"? | SELECT title , Studio FROM film WHERE Studio LIKE "%Universal%" | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | Show the studios that have not produced films with director "Walter Hill". | SELECT Studio FROM film EXCEPT SELECT Studio FROM film WHERE Director = "Walter Hill" | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | Which studios have never worked with the director Walter Hill? | SELECT Studio FROM film EXCEPT SELECT Studio FROM film WHERE Director = "Walter Hill" | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | List the studios which average gross is above 4500000. | SELECT Studio FROM film GROUP BY Studio HAVING avg(Gross_in_dollar) >= 4500000 | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | Which studios have an average gross of over 4500000? | SELECT Studio FROM film GROUP BY Studio HAVING avg(Gross_in_dollar) >= 4500000 | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | What is the title of the film that has the highest high market estimation. | SELECT t1.title FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID ORDER BY high_estimate DESC LIMIT 1 | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | Return the title of the film with the highest high estimate? | SELECT t1.title FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID ORDER BY high_estimate DESC LIMIT 1 | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | What are the titles and directors of the films were never presented in China? | SELECT title , director FROM film WHERE film_id NOT IN (SELECT film_id FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.market_id = T2.Market_ID WHERE country = 'China') | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
film_rank | Return the titles and directors of films that were never in the market of China. | SELECT title , director FROM film WHERE film_id NOT IN (SELECT film_id FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.market_id = T2.Market_ID WHERE country = 'China') | CREATE TABLE "film" (
"Film_ID" int,
"Title" text,
"Studio" text,
"Director" text,
"Gross_in_dollar" int,
PRIMARY KEY ("Film_ID")
)
3 rows from film table:
Film_ID Title Studio Director Gross_in_dollar
1 ET the Extra-Terrestrial Universal Steven Spielberg 435110554
2 Tootsie Columbia Sydney Pollack 177200000
3 An Officer and a Gentleman Paramount / Lorimar Taylor Hackford 129795554
CREATE TABLE "market" (
"Market_ID" int,
"Country" text,
"Number_cities" int,
PRIMARY KEY ("Market_ID")
)
3 rows from market table:
Market_ID Country Number_cities
1 Japan 209
2 China 540
3 USA 700
CREATE TABLE "film_market_estimation" (
"Estimation_ID" int,
"Low_Estimate" real,
"High_Estimate" real,
"Film_ID" int,
"Type" text,
"Market_ID" int,
"Year" int,
PRIMARY KEY ("Estimation_ID"),
FOREIGN KEY ("Film_ID") REFERENCES film("Film_ID"),
FOREIGN KEY ("Market_ID") REFERENCES market("Market_ID")
)
3 rows from film_market_estimation table:
Estimation_ID Low_Estimate High_Estimate Film_ID Type Market_ID Year
1 80000.0 80400.0 1 Mass suicide murder 1 1945
2 8000.0 8000.0 2 Mass suicide 2 1944
3 3000.0 80400.0 3 Mass human sacrifice 3 1487
|
cre_Doc_Tracking_DB | How many calendar items do we have? | SELECT count(*) FROM Ref_calendar | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | Count the number of all the calendar items. | SELECT count(*) FROM Ref_calendar | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | Show all calendar dates and day Numbers. | SELECT calendar_date , day_Number FROM Ref_calendar | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | What are all the calendar dates and day Numbers? | SELECT calendar_date , day_Number FROM Ref_calendar | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | Show the number of document types. | SELECT count(*) FROM Ref_document_types | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | How many document types are there? | SELECT count(*) FROM Ref_document_types | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | List all document type codes and document type names. | SELECT document_type_code , document_type_name FROM Ref_document_types | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | What are all the document type codes and document type names? | SELECT document_type_code , document_type_name FROM Ref_document_types | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | What is the name and description for document type code RV? | SELECT document_type_name , document_type_description FROM Ref_document_types WHERE document_type_code = "RV" | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | Give me the name and description of the document type code RV. | SELECT document_type_name , document_type_description FROM Ref_document_types WHERE document_type_code = "RV" | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | What is the document type code for document type "Paper"? | SELECT document_type_code FROM Ref_document_types WHERE document_type_name = "Paper" | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | Find the code of the document type "Paper". | SELECT document_type_code FROM Ref_document_types WHERE document_type_name = "Paper" | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | Show the number of documents with document type code CV or BK. | SELECT count(*) FROM All_documents WHERE document_type_code = "CV" OR document_type_code = "BK" | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | How many documents have document type code CV or BK? | SELECT count(*) FROM All_documents WHERE document_type_code = "CV" OR document_type_code = "BK" | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | What is the date when the document "Marry CV" was stored? | SELECT date_stored FROM All_documents WHERE Document_name = "Marry CV" | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | When was the document named "Marry CV" stored? Give me the date. | SELECT date_stored FROM All_documents WHERE Document_name = "Marry CV" | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | What is the day Number and date of all the documents? | SELECT T2.day_Number , T1.Date_Stored FROM All_documents AS T1 JOIN Ref_calendar AS T2 ON T1.date_stored = T2.calendar_date | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | Return the day Number and stored date for all the documents. | SELECT T2.day_Number , T1.Date_Stored FROM All_documents AS T1 JOIN Ref_calendar AS T2 ON T1.date_stored = T2.calendar_date | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | What is the document type name for the document with name "How to read a book"? | SELECT T2.document_type_name FROM All_documents AS T1 JOIN Ref_document_types AS T2 ON T1.document_type_code = T2.document_type_code WHERE T1.document_name = "How to read a book" | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | Find the document type name of the document named "How to read a book". | SELECT T2.document_type_name FROM All_documents AS T1 JOIN Ref_document_types AS T2 ON T1.document_type_code = T2.document_type_code WHERE T1.document_name = "How to read a book" | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | Show the number of locations. | SELECT count(*) FROM Ref_locations | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | How many locations are listed in the database? | SELECT count(*) FROM Ref_locations | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | List all location codes and location names. | SELECT location_code , location_name FROM Ref_locations | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | What are all the location codes and location names? | SELECT location_code , location_name FROM Ref_locations | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | What are the name and description for location code x? | SELECT location_name , location_description FROM Ref_locations WHERE location_code = "x" | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | Give me the name and description of the location with code x. | SELECT location_name , location_description FROM Ref_locations WHERE location_code = "x" | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | What is the location code for the country "Canada"? | SELECT location_code FROM Ref_locations WHERE location_name = "Canada" | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | Show the location code of the country "Canada". | SELECT location_code FROM Ref_locations WHERE location_name = "Canada" | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | How many roles are there? | SELECT count(*) FROM ROLES | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | Count the total number of roles listed. | SELECT count(*) FROM ROLES | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | List all role codes, role names, and role descriptions. | SELECT role_code , role_name , role_description FROM ROLES | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | What are all the role codes, role names, and role descriptions? | SELECT role_code , role_name , role_description FROM ROLES | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | What are the name and description for role code "MG"? | SELECT role_name , role_description FROM ROLES WHERE role_code = "MG" | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | Find the name and description of the role with code "MG". | SELECT role_name , role_description FROM ROLES WHERE role_code = "MG" | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | Show the description for role name "Proof Reader". | SELECT role_description FROM ROLES WHERE role_name = "Proof Reader" | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | What is the description of the role named "Proof Reader"? | SELECT role_description FROM ROLES WHERE role_name = "Proof Reader" | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | How many employees do we have? | SELECT count(*) FROM Employees | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | Find the number of employees we have. | SELECT count(*) FROM Employees | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | Show the name, role code, and date of birth for the employee with name 'Armani'. | SELECT employee_name , role_code , date_of_birth FROM Employees WHERE employee_Name = 'Armani' | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
cre_Doc_Tracking_DB | What are the name, role code, and date of birth of the employee named 'Armani'? | SELECT employee_name , role_code , date_of_birth FROM Employees WHERE employee_Name = 'Armani' | CREATE TABLE Ref_Document_Types (
Document_Type_Code CHAR(15) NOT NULL,
Document_Type_Name VARCHAR(255) NOT NULL,
Document_Type_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Document_Type_Code)
)
3 rows from Ref_Document_Types table:
Document_Type_Code Document_Type_Name Document_Type_Description
CV CV
BK Book
PR Paper
CREATE TABLE Ref_Calendar (
Calendar_Date DATETIME NOT NULL,
Day_Number INTEGER,
PRIMARY KEY (Calendar_Date)
)
3 rows from Ref_Calendar table:
Calendar_Date Day_Number
1972-03-31 09:47:22 5
1976-06-15 03:40:06 7
1985-05-13 12:19:43 7
CREATE TABLE Ref_Locations (
Location_Code CHAR(15) NOT NULL,
Location_Name VARCHAR(255) NOT NULL,
Location_Description VARCHAR(255) NOT NULL,
PRIMARY KEY (Location_Code)
)
3 rows from Ref_Locations table:
Location_Code Location_Name Location_Description
b Brazil
c Canada
e Edinburgh
CREATE TABLE Roles (
Role_Code CHAR(15) NOT NULL,
Role_Name VARCHAR(255),
Role_Description VARCHAR(255),
PRIMARY KEY (Role_Code)
)
3 rows from Roles table:
Role_Code Role_Name Role_Description
MG Manager Vero harum corrupti odit ipsa vero et odio. Iste et recusandae temporibus maxime. Magni aspernatur fugit quis explicabo totam esse corrupti.
ED Editor Itaque dolor ut nemo rerum vitae provident. Vel laborum ipsum velit sint. Et est omnis dignissimos.
PT Photo Aut modi nihil molestias temporibus sit rerum. Sit neque eaque odio omnis incidunt.
CREATE TABLE All_Documents (
Document_ID INTEGER NOT NULL,
Date_Stored DATETIME,
Document_Type_Code CHAR(15) NOT NULL,
Document_Name CHAR(255),
Document_Description CHAR(255),
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Document_Type_Code) REFERENCES Ref_Document_Types (Document_Type_Code),
FOREIGN KEY (Date_Stored) REFERENCES Ref_Calendar (Calendar_Date)
)
3 rows from All_Documents table:
Document_ID Date_Stored Document_Type_Code Document_Name Document_Description Other_Details
7 1976-06-15 03:40:06 CV Robin CV None None
11 1986-10-14 17:53:39 CV Marry CV None None
25 2008-06-08 12:45:38 BK One hundred years of solitude None None
CREATE TABLE Employees (
Employee_ID INTEGER NOT NULL,
Role_Code CHAR(15) NOT NULL,
Employee_Name VARCHAR(255),
Gender_MFU CHAR(1) NOT NULL,
Date_of_Birth DATETIME NOT NULL,
Other_Details VARCHAR(255),
PRIMARY KEY (Employee_ID),
FOREIGN KEY (Role_Code) REFERENCES Roles (Role_Code)
)
3 rows from Employees table:
Employee_ID Role_Code Employee_Name Gender_MFU Date_of_Birth Other_Details
25 HR Leo 1973-02-15 17:16:00 None
30 MG Ebba 1979-09-20 12:50:15 None
38 ED Stephanie 1 2012-03-30 23:02:28 None
CREATE TABLE Document_Locations (
Document_ID INTEGER NOT NULL,
Location_Code CHAR(15) NOT NULL,
Date_in_Location_From DATETIME NOT NULL,
Date_in_Locaton_To DATETIME,
PRIMARY KEY (Document_ID, Location_Code, Date_in_Location_From),
FOREIGN KEY (Location_Code) REFERENCES Ref_Locations (Location_Code),
FOREIGN KEY (Date_in_Location_From) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Date_in_Locaton_To) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Document_Locations table:
Document_ID Location_Code Date_in_Location_From Date_in_Locaton_To
7 e 2017-01-06 23:17:22 2008-06-08 12:45:38
11 x 2017-01-06 23:17:22 2012-07-03 09:48:46
81 c 1972-03-31 09:47:22 1987-11-05 06:11:22
CREATE TABLE Documents_to_be_Destroyed (
Document_ID INTEGER NOT NULL,
Destruction_Authorised_by_Employee_ID INTEGER,
Destroyed_by_Employee_ID INTEGER,
Planned_Destruction_Date DATETIME,
Actual_Destruction_Date DATETIME,
Other_Details VARCHAR(255),
PRIMARY KEY (Document_ID),
FOREIGN KEY (Destroyed_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Destruction_Authorised_by_Employee_ID) REFERENCES Employees (Employee_ID),
FOREIGN KEY (Planned_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Actual_Destruction_Date) REFERENCES Ref_Calendar (Calendar_Date),
FOREIGN KEY (Document_ID) REFERENCES All_Documents (Document_ID)
)
3 rows from Documents_to_be_Destroyed table:
Document_ID Destruction_Authorised_by_Employee_ID Destroyed_by_Employee_ID Planned_Destruction_Date Actual_Destruction_Date Other_Details
7 156 138 1988-02-01 14:41:52 2017-01-06 23:17:22 None
11 55 173 2010-11-26 19:22:50 1986-10-14 17:53:39 None
25 183 156 2009-08-18 03:29:08 1995-01-01 03:52:11 None
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.