Question: Write the following database modifications, based on the database schema: CREATE TABLE region ( r _ regionkey decimal ( 2 , 0 ) not null,
Write the following database modifications, based on the
database schema:
CREATE TABLE region
rregionkey decimal not null,
rname char not null,
rcomment varchar
;
CREATE TABLE nation
nnationkey decimal not null,
nname char not null,
nregionkey decimal not null,
ncomment varchar
;
CREATE TABLE part
ppartkey decimal not null,
pname varchar not null,
pmfgr char not null,
pbrand char not null,
ptype varchar not null,
psize decimal not null,
pcontainer char not null,
pretailprice decimal not null,
pcomment varchar not null
;
CREATE TABLE supplier
ssuppkey decimal not null,
sname char not null,
saddress varchar not null,
snationkey decimal not null,
sphone char not null,
sacctbal decimal not null,
scomment varchar not null
;
CREATE TABLE partsupp
pspartkey decimal not null,
pssuppkey decimal not null,
psavailqty decimal not null,
pssupplycost decimal not null,
pscomment varchar not null
;
CREATE TABLE customer
ccustkey decimal not null,
cname varchar not null,
caddress varchar not null,
cnationkey decimal not null,
cphone char not null,
cacctbal decimal not null,
cmktsegment char not null,
ccomment varchar not null
;
CREATE TABLE orders
oorderkey decimal not null,
ocustkey decimal not null,
oorderstatus char not null,
ototalprice decimal not null,
oorderdate date not null,
oorderpriority char not null,
oclerk char not null,
oshippriority decimal not null,
ocomment varchar not null
;
CREATE TABLE lineitem
lorderkey decimal not null,
lpartkey decimal not null,
lsuppkey decimal not null,
llinenumber decimal not null,
lquantity decimal not null,
lextendedprice decimal not null,
ldiscount decimal not null,
ltax decimal not null,
lreturnflag char not null,
llinestatus char not null,
lshipdate date not null,
lcommitdate date not null,
lreceiptdate date not null,
lshipinstruct char not null,
lshipmode char not null,
lcomment varchar not null
;
a Compute, for every country, the value of economic exchange, ie the difference between the number
of items from suppliers in that country sold to customers in other countries and the number of items
bought by local customers from foreign suppliers in l shipdate
b Compute the change in the economic exchange for every country between and There should
be two columns in the output for every country: and Hint: use CASE to select the values
in the result.
c Find the distinct parts p name ordered by customers from ASIA that are supplied by exactly suppliers
from AFRICA.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
