Question: CSE 1 1 1 DATABASE SYSTEMS Lab 9 : Views In this lab session you will learn how to work with SQL views. You will
CSE DATABASE SYSTEMS
Lab : Views
In this lab session you will learn how to work with SQL views. You will create views based on queries from
Lab and rewrite the same queries with the views. You will do all these in a Java or Python application,
for which we provide skeleton code Lab java and Python Lab py While you have the freedom to
choose which programming language you use, you have to completely implement the lab in one of the two
languages.
The tasks you have to implement are the following:
Create a view Vc custkey, c name, c address, c phone, c acctbal, c mktsegment, c comment, c nation,
c region that appends the country and region name to every customer. Rewrite Q from Lab with
view V
Create a view Vo orderkey, o custkey, o orderstatus, o totalprice, o orderyear, o orderpriority, o clerk,
o shippriority, o comment that replaces o orderdate with the year o orderyear and contains all the
other attributes in orders. Rewrite Q from Lab with views V and V
Rewrite Q from Lab with view V
Create a view Vs suppkey, s name, s address, s phone, s acctbal, s comment, s nation, s region that
appends the country and region name to every supplier. Rewrite Q from Lab with view V
Rewrite Q from Lab with view V
Rewrite Q from Lab with views V
Rewrite Q from Lab with views V and V
Rewrite Q from Lab with views V and V
Rewrite Q from Lab with views V and V
Create a view Vp type, min discount, max discount that computes the minimum and maximum
discount for every type of part. Rewrite Q from Lab with view V
Create two views Vc custkey, c name, c nationkey, c acctbal and Vs suppkey, s name, s nationkey,
s acctbal that contain the customers with negative balance and the suppliers with positive balance,
respectively. Rewrite Q from Lab with views V and V
Rewrite Q from Lab with view V
Rewrite Q from Lab with views V and V
Rewrite Q from Lab with views V and V
Rewrite Q from Lab with view V
In order to complete the lab you have to perform the following tasks:
Write the Java code that implements the required functionality in the corresponding methods in
file Lab java. If you use Python, you edit the file Lab py This is the only file you have to
edit. Moreover, you have to write code only in the specified methodsfunctions There are such
methodsfunctions overall.
For your reference, we provide you the SQL statements for all the queries in Lab in file querieslabsql
The format of the expected output for every query is available in outputxout.
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
