Question

SQL FORMAT (1-3 and 11-13 are completed and correct) -- 1. what is the average age...

SQL FORMAT (1-3 and 11-13 are completed and correct)

-- 1. what is the average age of people from China?
select avg(age) from census where native_country ='China';

-- 2. what is the average age of people from Taiwan?
select avg(age) from census where native_country = ‘Taiwan’;

-- 3. which native countries have "land" in their name?
select distinct(native_country) from census where native_country like '%land$

-- 4. what values of the attribute 'marital_status' appear in the data set? Don't show duplicates.


-- 5. what is the average hours per week of work for people from France between 18 and 25? (inclusive)


-- 6. which people (show all columns) are from Laos, Cuba, or Peru? Show only 10 lines.


-- 7. what is the average education years for people having a native country that is not the US?


-- 8. how many executive managers in the data set?


-- 9. how many executive managers have more than 12 years of education?


-- 10. how many different native countries are found in the data set?

-- 11. what are the names of all students who have taken some course? Don't show duplicates.
select distinct(name) from student where tot_cred > 0;

-- 12. what are the names of departments that offer 4-credit courses? Don't list duplicates.
select distinct(dept_name) from course where credits=4;

-- 13. What are the names and IDs of all students who have received an A in a computer science class?
select distinct(name), id from student natural join takes natural join cours$

-- 14. How many B grades have been given to physics majors?


-- 15. What is the average total credits of students who have taken CS-319?


-- 16. What is the average total credits of students who have taken CS-101?


-- 17. What are the course IDs of courses taught by instructor Katz?


-- 18. What are the course IDs of all courses offered by instructor Crick's department?


-- 19. What is the course_id, semester, and year of sections of computer science courses?
-- Don't show duplicates.


-- 20. What are the names of students who have taken a class taught by instructor Srinivasan?

Homework Answers

Answer #1
4. 
select distinct(marital_status)
from census;

5.
select avg(hours_per_week)
from census
where native_country='France'
and age>17
and age<26;

6.
select *
from census
where native_country='Laos'
or native_country='Cuba'
or native_country='Peru'
limit=10;

7.
select avg(edu_years)
from census
where not native_country='US';

8.
select count(*)
from census
where designation='executive manager';

9.
select count(*)
from census
where designation='executive manager'
and edu_years>12;

10.
select count (distinct native_country)
from census;

Post rest of the questions separately.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Practice writing SQL queries ----------------------------- For this question, we will consider the following tables about people,...
Practice writing SQL queries ----------------------------- For this question, we will consider the following tables about people, grades, and courses. Your task is to express each of the given queries in SQL. Example data are provided in these tables for your convenience but note that they are only example data. Your queries must work for all potential data residing in the given tables, not just those illustrated here. People (id, name, age, address) --------------------------------------------------- p1 | Tom Martin| 24 | 11,...
The owner of a local golf course wants to determine the average age of the golfers...
The owner of a local golf course wants to determine the average age of the golfers that play on the course in relation to the average age in the area. According to the most recent census, the town has an average age of 23.44. In a random sample of 26 golfers that visited his course, the sample mean was 30.63 and the standard deviation was 8.771. Using this information, the owner calculated the confidence interval of (25.84, 35.42) with a...
1. City wants to make a 98% confidence interval for the average height of students. The...
1. City wants to make a 98% confidence interval for the average height of students. The margin of error is to be more than 2.5 inches. From experience, you believe the standard deviation of the hights to be 3 inches. What is the minimum required number of students you must measure? 2. According to advertising claims. allowed couples to increase the chances of having a baby girl. Suppose we conduct an experiment with 100 couples who want to have baby...
PART 1: Sampling How we select our sample will directly influence the external validity of the...
PART 1: Sampling How we select our sample will directly influence the external validity of the study. If a sample is representative, then our external validity is stronger. If a sample is non-representative, then our external validity is weaker. QUESTIONS: 1. You are interested in looking at the relationship between student-to-teacher ratio and GPA at California 2- and 4-year colleges. You suspect that average GPA is higher at 2-year colleges where student-to-teacher ratio is low, relative to 4-year colleges colleges...
****PLEASE ANSWER ALL QUESTIONS**** Question 7 (1 point) The owner of a local golf course wants...
****PLEASE ANSWER ALL QUESTIONS**** Question 7 (1 point) The owner of a local golf course wants to determine the average age of the golfers that play on the course in relation to the average age in the area. According to the most recent census, the town has an average age of 38.58. In a random sample of 20 golfers that visited his course, the sample mean was 36.61 and the standard deviation was 7.505. Using this information, the owner calculated...
1. The average final exam score for the statistics course is 78%. A professor wants to...
1. The average final exam score for the statistics course is 78%. A professor wants to see if the average final exam score for students who are given colored pens on the first day of class is different. The final exam scores for the 11 randomly selected students who were given the colored pens are shown below. Assume that the distribution of the population is normal. 77, 58, 53, 90, 83, 77, 51, 72, 53, 68, 81 What can be...
What Statistical Test Should I Use Please indicate the type of test needed to analyze the...
What Statistical Test Should I Use Please indicate the type of test needed to analyze the data described. Hints: Think about the IV and DV.   How many levels of the IV?  Are they repeated measures? Are the data categorical? A. z-test B. One-Sample t-Test C. Dependent Measures t-Test D. Independent Measures t-Test E. One-way ANOVA E. One-way ANOVA F. Post-hoc tests G. Between-Subjects Factorial ANOVA H. Chi-Square test of Independence ________ 1. Compare spatial task scores after 0 or 3 drinks....
PART 1: Critical Thinking ARTICLE adapted from: Low-Income Parents Of 'Difficult Children' Likely To Use iPads...
PART 1: Critical Thinking ARTICLE adapted from: Low-Income Parents Of 'Difficult Children' Likely To Use iPads To Pacify Kids 2 March 2016, 9:27 pm EST By Angela Laguipo Tech Times In a world of technological advancement, mobile devices are widely used by people of all ages, including children. A new study found that when children are in tough situations and are having emotional difficulties, their parents are more likely to give an iPad than when the children are behaving calmly....
WRITE AN APPROPRIATE CONCLUSION TO COMPLETE THE ESSAY BELOW. The world is currently faced with a...
WRITE AN APPROPRIATE CONCLUSION TO COMPLETE THE ESSAY BELOW. The world is currently faced with a global pandemic of the novel Coronavirus disease 2019 (Covid-19) which quickly spread to many countries of the world. Measures were enforced in each country to stop the spread of the virus. One of the measures taken was the abrupt closure of all schools which led schools to explore online teaching methods to continue learning among its students. Several categories of online teaching methods were...
Question 1 Suppose you needed to form a 92% confidence interval for a population mean. What...
Question 1 Suppose you needed to form a 92% confidence interval for a population mean. What z value would you use? A. 1.41 B. .82 C. 1.96 D. 1.75 Question 2 Which of the following is a way to INCREASE the width of a confidence interval? A. increase the chance for error B. increase the confidence level C. decrease the error D. increase the sample size Question 3 In a random sample of 60 computers, the mean repair cost was...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT