CREATE TABLE "replaced_pageants" (
  "country_territory" text,
  "former_pageant" text,
  "last_competed" real,
  "new_pageant" text,
  "franchise_since" real
);

Question: which country has miss universe Hungary as former pageant?
SQL: SELECT "country_territory" FROM "replaced_pageants" WHERE "former_pageant"='Miss Universe Hungary';

Question: which is the former pageant in the country where the new pageant is miss bahamas?
SQL: SELECT "former_pageant" FROM "replaced_pageants" WHERE "new_pageant"='Miss Bahamas';

Question: when did new zealand last compete?
SQL: SELECT MAX("last_competed") FROM "replaced_pageants" WHERE "country_territory"='New Zealand';

Question: How many new pageants does Aruba have?
SQL: SELECT COUNT("new_pageant") FROM "replaced_pageants" WHERE "country_territory"='Aruba';

Question: which is the new pageant from spain?
SQL: SELECT "new_pageant" FROM "replaced_pageants" WHERE "country_territory"='Spain';