Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Look at the student-code.sql below to see what a homework file looks like. Each problem is described on a problem line that starts with something

Look at the student-code.sql below to see what a homework file looks like. Each problem is described on a problem line that starts with something like "-- 4. ". The student response is on the lines following the problem.

Instructions: Given an input value, like 4, the AWK script should return the response to the problem. Please note that a response ends with either: a new problem line, the end of the file, or a line that begins with three or more hyphens.

---> Please provide the AWK statement to display the result of the input

************************student-code.sql ********************************

----------------------------------------------------------------------------$ -- Edit this file by adding your SQL below each question. ----------------------------------------------------------------------------$

------------------------------------------------------------- -- The following queries are based on the 1994 census data. -------------------------------------------------------------

.read 1994-census-summary-1.sql

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

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

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

----------------------------------------------------------------------------$ -- The following queries are based on the courses-ddl.sql and courses-small.$ ----------------------------------------------------------------------------$

drop table census; .read courses-ddl.sql .read courses-small-1.sql

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

-- 12. what are the names of departments that offer 4-credit courses? Don't $ 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 $ select distinct(name), id from student natural join takes natural join cours$

******************************************************************

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Rules In Database Systems Third International Workshop Rids 97 Sk Vde Sweden June 26 28 1997 Proceedings Lncs 1312

Authors: Andreas Geppert ,Mikael Berndtsson

1997th Edition

3540635165, 978-3540635161

More Books

Students also viewed these Databases questions

Question

Prepare for a successful job interview.

Answered: 1 week ago

Question

Describe barriers to effective listening.

Answered: 1 week ago

Question

List the guidelines for effective listening.

Answered: 1 week ago