SQL
stringlengths 18
577
| question
stringlengths 317
11.5k
|
---|---|
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
|
Given the Table people having columns as People_ID has datatype number, Age has datatype number, Name has datatype text, Nationality has datatype text, Graduation_College has datatype text which has People_ID and Given the Table company having columns as Company_ID has datatype number, Name has datatype text, Headquarters has datatype text, Industry has datatype text, Sales_in_Billion has datatype number, Profits_in_Billion has datatype number, Assets_in_Billion has datatype number, Market_Value_in_Billion has datatype number which has Company_ID and Given the Table employment having columns as Company_ID has datatype number, People_ID has datatype number, Year_working has datatype number which has Company_ID. Answer the question by writing the appropriate SQL code. Show names of companies and that of employees in descending order of number of years working for that employee.
|
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
|
Given the Table people having columns as People_ID has datatype number, Age has datatype number, Name has datatype text, Nationality has datatype text, Graduation_College has datatype text which has People_ID and Given the Table company having columns as Company_ID has datatype number, Name has datatype text, Headquarters has datatype text, Industry has datatype text, Sales_in_Billion has datatype number, Profits_in_Billion has datatype number, Assets_in_Billion has datatype number, Market_Value_in_Billion has datatype number which has Company_ID and Given the Table employment having columns as Company_ID has datatype number, People_ID has datatype number, Year_working has datatype number which has Company_ID. Answer the question by writing the appropriate SQL code. Show the names of employees that work for companies with sales bigger than 200.
|
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
|
Given the Table people having columns as People_ID has datatype number, Age has datatype number, Name has datatype text, Nationality has datatype text, Graduation_College has datatype text which has People_ID and Given the Table company having columns as Company_ID has datatype number, Name has datatype text, Headquarters has datatype text, Industry has datatype text, Sales_in_Billion has datatype number, Profits_in_Billion has datatype number, Assets_in_Billion has datatype number, Market_Value_in_Billion has datatype number which has Company_ID and Given the Table employment having columns as Company_ID has datatype number, People_ID has datatype number, Year_working has datatype number which has Company_ID. Answer the question by writing the appropriate SQL code. Show the names of companies and the number of employees they have
|
SELECT Name FROM people WHERE People_ID NOT IN (SELECT People_ID FROM employment)
|
Given the Table people having columns as People_ID has datatype number, Age has datatype number, Name has datatype text, Nationality has datatype text, Graduation_College has datatype text which has People_ID and Given the Table company having columns as Company_ID has datatype number, Name has datatype text, Headquarters has datatype text, Industry has datatype text, Sales_in_Billion has datatype number, Profits_in_Billion has datatype number, Assets_in_Billion has datatype number, Market_Value_in_Billion has datatype number which has Company_ID and Given the Table employment having columns as Company_ID has datatype number, People_ID has datatype number, Year_working has datatype number which has Company_ID. Answer the question by writing the appropriate SQL code. List the names of people that are not employed by any company
|
SELECT name FROM company WHERE Sales_in_Billion > 200 ORDER BY Sales_in_Billion , Profits_in_Billion DESC
|
Given the Table people having columns as People_ID has datatype number, Age has datatype number, Name has datatype text, Nationality has datatype text, Graduation_College has datatype text which has People_ID and Given the Table company having columns as Company_ID has datatype number, Name has datatype text, Headquarters has datatype text, Industry has datatype text, Sales_in_Billion has datatype number, Profits_in_Billion has datatype number, Assets_in_Billion has datatype number, Market_Value_in_Billion has datatype number which has Company_ID and Given the Table employment having columns as Company_ID has datatype number, People_ID has datatype number, Year_working has datatype number which has Company_ID. Answer the question by writing the appropriate SQL code. list the names of the companies with more than 200 sales in the descending order of sales and profits.
|
SELECT count(*) FROM film
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. How many film are there?
|
SELECT count(*) FROM film
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. Count the number of films.
|
SELECT DISTINCT Director FROM film
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. List the distinct director of all films.
|
SELECT DISTINCT Director FROM film
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. What are the different film Directors?
|
SELECT avg(Gross_in_dollar) FROM film
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. What is the average ticket sales gross in dollars of films?
|
SELECT avg(Gross_in_dollar) FROM film
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. Return the average gross sales in dollars across all films.
|
SELECT Low_Estimate , High_Estimate FROM film_market_estimation
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. What are the low and high estimates of film markets?
|
SELECT Low_Estimate , High_Estimate FROM film_market_estimation
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. Return the low and high estimates for all film markets.
|
SELECT TYPE FROM film_market_estimation WHERE YEAR = 1995
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. What are the types of film market estimations in year 1995?
|
SELECT TYPE FROM film_market_estimation WHERE YEAR = 1995
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. Return the types of film market estimations in 1995.
|
SELECT max(Number_cities) , min(Number_cities) FROM market
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. What are the maximum and minimum number of cities in all markets.
|
SELECT max(Number_cities) , min(Number_cities) FROM market
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. Return the maximum and minimum number of cities across all markets.
|
SELECT count(*) FROM market WHERE Number_cities < 300
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. How many markets have number of cities smaller than 300?
|
SELECT count(*) FROM market WHERE Number_cities < 300
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. Count the number of markets that have a number of cities lower than 300.
|
SELECT Country FROM market ORDER BY Country ASC
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. List all countries of markets in ascending alphabetical order.
|
SELECT Country FROM market ORDER BY Country ASC
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. What are the countries for each market, ordered alphabetically?
|
SELECT Country FROM market ORDER BY Number_cities DESC
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. List all countries of markets in descending order of number of cities.
|
SELECT Country FROM market ORDER BY Number_cities DESC
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. What are the countries for each market ordered by decreasing number of cities?
|
SELECT T1.Title , T2.Type FROM film AS T1 JOIN film_market_estimation AS T2 ON T1.Film_ID = T2.Film_ID
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. 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
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. What are the titles of films and corresponding types of market estimations?
|
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
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. 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
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. Who are the different directors of films which had market estimation in 1995?
|
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
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. 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
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. Give the average number of cities within markets that had a low market estimation larger than 10000?
|
SELECT T2.Country , T1.Year FROM film_market_estimation AS T1 JOIN market AS T2 ON T1.Market_ID = T2.Market_ID
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. 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
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. What are the countries of markets and their corresponding years of market estimation?
|
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
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. 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
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. What are the years of film market estimation for the market of Japan, ordered by year descending?
|
SELECT Studio , COUNT(*) FROM film GROUP BY Studio
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. List the studios of each film and the number of films produced by that studio.
|
SELECT Studio , COUNT(*) FROM film GROUP BY Studio
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. How films are produced by each studio?
|
SELECT Studio FROM film GROUP BY Studio ORDER BY COUNT(*) DESC LIMIT 1
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. 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
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. What is the name of teh studio that created the most films?
|
SELECT Studio FROM film GROUP BY Studio HAVING COUNT(*) >= 2
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. List the names of studios that have at least two films.
|
SELECT Studio FROM film GROUP BY Studio HAVING COUNT(*) >= 2
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. What are the names of studios that have made two or more films?
|
SELECT Title FROM film WHERE Film_ID NOT IN (SELECT Film_ID FROM film_market_estimation)
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. 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)
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. What are the titles of films that do not have a film market estimation?
|
SELECT Studio FROM film WHERE Director = "Nicholas Meyer" INTERSECT SELECT Studio FROM film WHERE Director = "Walter Hill"
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. 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"
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. What are the names of studios that have produced films with both Nicholas Meyer and Walter Hill?
|
SELECT title , Studio FROM film WHERE Studio LIKE "%Universal%"
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. 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%"
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. What are the titles and studios of films that have been produced by a studio whose name contains "Universal"?
|
SELECT Studio FROM film EXCEPT SELECT Studio FROM film WHERE Director = "Walter Hill"
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. 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"
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. Which studios have never worked with the director Walter Hill?
|
SELECT Studio FROM film GROUP BY Studio HAVING avg(Gross_in_dollar) >= 4500000
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. List the studios which average gross is above 4500000.
|
SELECT Studio FROM film GROUP BY Studio HAVING avg(Gross_in_dollar) >= 4500000
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. Which studios have an average gross of over 4500000?
|
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
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. 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
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. Return the title of the film with the highest high estimate?
|
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')
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. 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')
|
Given the Table film having columns as Film_ID has datatype number, Title has datatype text, Studio has datatype text, Director has datatype text, Gross_in_dollar has datatype number which has Film_ID and Given the Table market having columns as Market_ID has datatype number, Country has datatype text, Number_cities has datatype number which has Market_ID and Given the Table film market estimation having columns as Estimation_ID has datatype number, Low_Estimate has datatype number, High_Estimate has datatype number, Film_ID has datatype number, Type has datatype text, Market_ID has datatype number, Year has datatype number which has Estimation_ID. Answer the question by writing the appropriate SQL code. Return the titles and directors of films that were never in the market of China.
|
SELECT count(*) FROM Ref_calendar
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. How many calendar items do we have?
|
SELECT count(*) FROM Ref_calendar
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. Count the number of all the calendar items.
|
SELECT calendar_date , day_Number FROM Ref_calendar
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. Show all calendar dates and day Numbers.
|
SELECT calendar_date , day_Number FROM Ref_calendar
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. What are all the calendar dates and day Numbers?
|
SELECT count(*) FROM Ref_document_types
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. Show the number of document types.
|
SELECT count(*) FROM Ref_document_types
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. How many document types are there?
|
SELECT document_type_code , document_type_name FROM Ref_document_types
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. List all document type codes and document type names.
|
SELECT document_type_code , document_type_name FROM Ref_document_types
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. What are all the document type codes and document type names?
|
SELECT document_type_name , document_type_description FROM Ref_document_types WHERE document_type_code = "RV"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. 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"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. Give me the name and description of the document type code RV.
|
SELECT document_type_code FROM Ref_document_types WHERE document_type_name = "Paper"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. What is the document type code for document type "Paper"?
|
SELECT document_type_code FROM Ref_document_types WHERE document_type_name = "Paper"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. Find the code of the document type "Paper".
|
SELECT count(*) FROM All_documents WHERE document_type_code = "CV" OR document_type_code = "BK"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. 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"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. How many documents have document type code CV or BK?
|
SELECT date_stored FROM All_documents WHERE Document_name = "Marry CV"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. What is the date when the document "Marry CV" was stored?
|
SELECT date_stored FROM All_documents WHERE Document_name = "Marry CV"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. When was the document named "Marry CV" stored? Give me the date.
|
SELECT T2.day_Number , T1.Date_Stored FROM All_documents AS T1 JOIN Ref_calendar AS T2 ON T1.date_stored = T2.calendar_date
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. 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
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. Return the day Number and stored date for all the documents.
|
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"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. 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"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. Find the document type name of the document named "How to read a book".
|
SELECT count(*) FROM Ref_locations
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. Show the number of locations.
|
SELECT count(*) FROM Ref_locations
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. How many locations are listed in the database?
|
SELECT location_code , location_name FROM Ref_locations
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. List all location codes and location names.
|
SELECT location_code , location_name FROM Ref_locations
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. What are all the location codes and location names?
|
SELECT location_name , location_description FROM Ref_locations WHERE location_code = "x"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. What are the name and description for location code x?
|
SELECT location_name , location_description FROM Ref_locations WHERE location_code = "x"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. Give me the name and description of the location with code x.
|
SELECT location_code FROM Ref_locations WHERE location_name = "Canada"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. What is the location code for the country "Canada"?
|
SELECT location_code FROM Ref_locations WHERE location_name = "Canada"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. Show the location code of the country "Canada".
|
SELECT count(*) FROM ROLES
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. How many roles are there?
|
SELECT count(*) FROM ROLES
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. Count the total number of roles listed.
|
SELECT role_code , role_name , role_description FROM ROLES
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. List all role codes, role names, and role descriptions.
|
SELECT role_code , role_name , role_description FROM ROLES
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. What are all the role codes, role names, and role descriptions?
|
SELECT role_name , role_description FROM ROLES WHERE role_code = "MG"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. What are the name and description for role code "MG"?
|
SELECT role_name , role_description FROM ROLES WHERE role_code = "MG"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. Find the name and description of the role with code "MG".
|
SELECT role_description FROM ROLES WHERE role_name = "Proof Reader"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. Show the description for role name "Proof Reader".
|
SELECT role_description FROM ROLES WHERE role_name = "Proof Reader"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. What is the description of the role named "Proof Reader"?
|
SELECT count(*) FROM Employees
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. How many employees do we have?
|
SELECT count(*) FROM Employees
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. Find the number of employees we have.
|
SELECT employee_name , role_code , date_of_birth FROM Employees WHERE employee_Name = 'Armani'
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. 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'
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. What are the name, role code, and date of birth of the employee named 'Armani'?
|
SELECT employee_ID FROM Employees WHERE employee_name = "Ebba"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. What is the id for the employee called Ebba?
|
SELECT employee_ID FROM Employees WHERE employee_name = "Ebba"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. Show the id of the employee named Ebba.
|
SELECT employee_name FROM Employees WHERE role_code = "HR"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. Show the names of all the employees with role "HR".
|
SELECT employee_name FROM Employees WHERE role_code = "HR"
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. Which employees have the role with code "HR"? Find their names.
|
SELECT role_code , count(*) FROM Employees GROUP BY role_code
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. Show all role codes and the number of employees in each role.
|
SELECT role_code , count(*) FROM Employees GROUP BY role_code
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. What is the code of each role and the number of employees in each role?
|
SELECT role_code FROM Employees GROUP BY role_code ORDER BY count(*) DESC LIMIT 1
|
Given the Table reference document types having columns as Document_Type_Code has datatype text, Document_Type_Name has datatype text, Document_Type_Description has datatype text which has Document_Type_Code and Given the Table reference calendar having columns as Calendar_Date has datatype time, Day_Number has datatype number which has Calendar_Date and Given the Table reference locations having columns as Location_Code has datatype text, Location_Name has datatype text, Location_Description has datatype text which has Location_Code and Given the Table roles having columns as Role_Code has datatype text, Role_Name has datatype text, Role_Description has datatype text which has Role_Code and Given the Table all documents having columns as Document_ID has datatype number, Date_Stored has datatype time, Document_Type_Code has datatype text, Document_Name has datatype text, Document_Description has datatype text, Other_Details has datatype text which has Document_ID and Given the Table employees having columns as Employee_ID has datatype number, Role_Code has datatype text, Employee_Name has datatype text, Gender_MFU has datatype text, Date_of_Birth has datatype time, Other_Details has datatype text which has Employee_ID and Given the Table document locations having columns as Document_ID has datatype number, Location_Code has datatype text, Date_in_Location_From has datatype time, Date_in_Locaton_To has datatype time which has Document_ID and Given the Table documents to be destroyed having columns as Document_ID has datatype number, Destruction_Authorised_by_Employee_ID has datatype number, Destroyed_by_Employee_ID has datatype number, Planned_Destruction_Date has datatype time, Actual_Destruction_Date has datatype time, Other_Details has datatype text which has Document_ID. Answer the question by writing the appropriate SQL code. What is the role code with the largest number of employees?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.