SQL database: Write your query to retrieve data from the table. Link to get the
ID: 3879649 • Letter: S
Question
SQL database: Write your query to retrieve data from the table.
Link to get the databse: https://drive.google.com/file/d/0B0kVn308bqFuVV9PZXQxZDF1ME0/view?usp=sharing
a. show all columns for the people with a usid between 100 and 120 (inclusive)
b. show the workclass and education of people under 20
c. show all columns for people over 80
select * from census where age>80 limit 10;
d. show the age, sex, years of education, and capital gains of people with capital gains > 10000
e. show the sex, age, and marital status for people in the armed forces
f. show the number of years of education for people over 50 years old in the armed forces
g. show all columns for 17 year olds with less than 5 years of education
h. show the occupation of women under the age of 40 with a Doctorate degree
i. show all columns for people under the age of 21 with a Masters degree
j.show the age of females with either a bachelors or a masters degree
Explanation / Answer
a). select * from census where usid >= 100 and usid <= 120;
b).select education, workclass from census where age < 20;
c).select * from census where age > 80;
d).select age,sex,education_num, capital_gain from census where capital_gain > 10000;
e).select sex,age,marital_status from census where occupation = 'Armed_Forces';
f).select education_num from census where age > 50 and occupation = 'Armed_Forces';
g).select * from census where age = 17 and education_num < 5;
h).select occupation from census where sex = 'Female' and age < 40 and education = 'Doctorate';
i).select * from census where age < 21 and education = 'Masters';
j).select age from census where sex = 'Female' and (education = 'Masters' or education = 'Bachelors');
'
'
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.