Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Database Relational Algebra problems Consider two relation instances below, with

ID: 3663983 • Letter: D

Question

Database Relational Algebra problems

Consider two relation instances below, with the following schemas: Country (country name, continent); City (city name, country name. is_capital, population). In each question (a)-(d) below, write a relational algebra expression and show its result when the expression is executed with the given instances. List the names of all European cities with population of more than 600,000. List the names of all countries for which no cities have been entered into the City table. List names and continents of countries that are either in Europe or whose capitals have a population of over 1 million. List all pairs of cities such that one of them is a capital of some country, and the other is a non-capital city in that same country. For each city in the pair, list its name.

Explanation / Answer

·Select notation by symbol lower case sigma

select * from booksTable where

title = “Artificial Intelligence AI”

and cost = 525

or yearOfPublication >= 2007;

SELECT c.city_name FROM Country r, City c WHERE

c.population > “600,00”

lower sigma city_name = “ “ (City),

country_name = “ “ (Country, City),

continent = “Europe” (Country) and

population > “600,000” (City)

Berlin

Hamburg

Paris

Lyon

been entered in to the city table , in other words,

List the country names which do not have a

matching city name entry in the city table

SELECT r.country_name   FROM    Country r

    WHERE r.country_name NOT IN

(SELECT c.country_name FROM City c;)

England

SELECT r.country_name, r.continet WHERE r.continent = “Europe” OR

     c.population > “1,000,000”