Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You should write queries to answer the following questions. Use ' AS ' to change the column name where appropriate. Unless otherwise specified, you should
You should write queries to answer the following questions.
Use AS to change the column name where appropriate.
Unless otherwise specified, you should use SUBQUERIES and the quantifiers SOME, ANY, ALL, IN and NOT IN to answer the questions. Note that SQLite does not support SOME, ANY, ALL so you should use the equivalent minmax aggregate functions in the SUBQUERIES.. You should also write each clause on a separate line.
select staffNo, salary
from Staff
where salary
select avgsalary
from Staff
group by branchNo;
It is recommended that you develop the answer to the question in SQLite outside of Canvas. Add each query to a file one at a time as the previous one is determined to be correct for example, printingquerytssql
In SQLite you can use the command read to execute the SQL commands contained in a file, eg
sqliteread printingquerytssql
if you turn on command echo it will also output the sql to make it easier for a tutor to help you
sqliteecho ON
Tasks
Task
List the names and phone numbers of all customers who have a rush job jobtype R
Task
List all items with a price below the average price of an item.
Task
Find the earliest podate for each vendorid in the pos table, include all the columns from the pos table and order by vendorid This cannot be done by a GROUP BY You will need to use a correlated query based on the vendorid
Task
Find the poitems with quantity exceeding any ie at least one quantity for jobid Exclude job from the final output.
Task
Find all purchase orders POS for publishers with a credit code of C Remember KNOW THY SCHEMA: pos does not directly connected to publishers. Use SUBQUERIES and the IN operator.
Task
Find all publishers which have NOT had any bookjobs with pos from vendorid 'ABC'. Your answer needs to include publishers who have not had any bookjobs at all as well. Use NOT IN and IN
HINT: which publishers have had POS with the vendor with vendorid 'ABC'?
Task
Find all those poitems with an item that has a price exceeding and associated with one or more pos from vendorid ABC. Use the IN clause.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started