Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Help with SQL , please! We have the following database: world CREATE TABLE public.city ( id int 4 NOT NULL, name text NOT NULL, countrycode
Help with SQL please!
We have the following database: world
CREATE TABLE public.city
id int NOT NULL,
"name" text NOT NULL,
countrycode bpchar NOT NULL,
district text NOT NULL,
population int NOT NULL,
CONSTRAINT citypkey PRIMARY KEY id
;
public.city foreign keys
ALTER TABLE public.city ADD CONSTRAINT cityfk FOREIGN KEY countrycode REFERENCES public.countrycode;
CREATE TABLE public.country
code bpchar NOT NULL,
"name" text NOT NULL,
continent text NOT NULL,
region text NOT NULL,
surfacearea float NOT NULL,
indepyear int NULL,
population int NOT NULL,
lifeexpectancy float NULL,
gnp numeric NULL,
gnpold numeric NULL,
localname text NOT NULL,
governmentform text NOT NULL,
headofstate text NULL,
capital int NULL,
code bpchar NOT NULL,
CONSTRAINT countrycontinentcheck CHECK continent 'Asia'::text OR continent 'Europe'::text OR continent 'North America'::text OR continent 'Africa'::text OR continent 'Oceania'::text OR continent 'Antarctica'::text OR continent 'South America'::text
CONSTRAINT countrypkey PRIMARY KEY code
;
public.country foreign keys
ALTER TABLE public.country ADD CONSTRAINT countrycapitalfkey FOREIGN KEY capital REFERENCES public.cityid;
CREATE TABLE public.countrylanguage
countrycode bpchar NOT NULL,
"language" text NOT NULL,
isofficial bool NOT NULL,
percentage float NOT NULL,
CONSTRAINT countrylanguagepkey PRIMARY KEY countrycode language
;
public.countrylanguage foreign keys
ALTER TABLE public.countrylanguage ADD CONSTRAINT countrylanguagecountrycodefkey FOREIGN KEY countrycode REFERENCES public.countrycode;
Write a query to "world" database to find country with surface area under wich has the greatest number of people who speak English.
What country has more than words in its local name and has area per capita
Write a SQL query to find out which worlds capital has the least population?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started