human
Schema:
railway (Railway_ID, Railway, Builder, Built, Wheels, Location, ObjectNumber)
train (Train_ID, Train_Num, Name, From, Arrival, Railway_ID)
manager (Manager_ID, Name, Country, Working_year_starts, Age, Level)
railway_manage (Railway_ID, Manager_ID, From_Year)
Please answer with SQL.
assistant
Sure, I understand.
human
What is the maximum level of managers in countries that are not 'Australia'?
assistant
SELECT max(LEVEL) FROM manager WHERE Country != 'Australia '
human
Show the working years of managers in descending order of their level.
assistant
SELECT Working_year_starts FROM manager ORDER BY LEVEL DESC
human
What is the average age for all managers?
assistant
SELECT avg(Age) FROM manager
human
Show the distinct countries of managers.
assistant
SELECT DISTINCT Country FROM manager
human
Show the countries that have both managers of age above 50 and managers of age below 46.
assistant
SELECT Country FROM manager WHERE Age > 50 INTERSECT SELECT Country FROM manager WHERE Age < 46
human
Show the countries that have managers of age above 50 or below 46.
assistant
SELECT Country FROM manager WHERE Age > 50 OR Age < 46 ;