Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use the RelaX website: https://dbis-uibk.github.io/relax/calc/gist/c8e9a3660d48301c6c213a9f0f85c6e6 (Links to an external site.) Your task is to write SQL queries to solve the problems below. Copy all queries

Use the RelaX website: https://dbis-uibk.github.io/relax/calc/gist/c8e9a3660d48301c6c213a9f0f85c6e6 (Links to an external site.)

Your task is to write SQL queries to solve the problems below. Copy all queries to a single text file (make sure encoding is set to Unicode) and submit it once you are done.

  1. Compute a new table by selecting only the persons with an income between 20  and 30, and adding an attribute that has, for every tuple,  the same value as income.
  2. Generate a new table by selecting only the persons with income lower than 30, projecting the data (income) on the attribute salary,  and adding an attribute that has, for every tuple, twice the  value of the attribute salary (call it ‘doubleSalary’).
  3. Retrieve the fathers of persons who earn more than 20.
  4. Retrieve the father and mother of every single person.
  5. Retrieve persons that earn more than their father,  showing the person’s name and income, and income of the father.
  6. Using an Explicit Join, retrieve name, income, and the income of the father of all persons that earn more than their father. 
  7. For each group of adult persons who have the same age,  return the maximum income for every group and show the age.
  8. Retrieve the fathers whose children under age 30 have an average income greater than 20.


Step by Step Solution

3.40 Rating (162 Votes )

There are 3 Steps involved in it

Step: 1

1 select name age income as alsoincome from Person where income 20 and inc... 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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

When is an outer join used instead of a natural join?

Answered: 1 week ago