MIS 325 Lecture Notes - Lecture 24: Sql, Oracle Database, Sql*Plus

60 views2 pages
MIS 325 Intro to Unit 3 3.1
Answer to in class exercise 1:
SELECT vendor_id, sum(invoice_total) AS "Total Sum"
FROM Invoices
GROUP BY vendor_id
ORDER BY vendor_id
Exercise #2:
SELECT vendor_name, SUM(payment_total) AS payment_total_sum
FROM Vendors JOIN invoices
ON vendors.vendor_id = invoices.vendor_id
GROUP BY vendor_name
ORDER BY payment_total_sum DESC
Chapter 6 Coding subqueries
Subquery: select statement that is coded within another sql statement
Four ways to introduce subquery in SELECT statement
o In a WHERE clause as a search condition
o In a HAVING clause as a search condition
o In a FROM clause as a table specification
o In a SELECT clause as a column specification
SELECT statement returns either a table (rows and columns), vector (just a
column), or value (single value)
How to use the ALL keyword
Types of subqueries
o Correlated
Divide problem into smaller problems
Smallest problem = subquery
Outer layer/larger problem = outer query
Example in class: Subquery won’t run on their own
Search condition refers to a join condition but the second
table is not in the subquery’s FROM statement
It’s okay when subquery is embedded in larger shell, but
independently subquery cannot stand
This subquery within an outer query shows the idea of a
correlated subquery
Join and subquery can be interchangeable both do the same thing
Chapter 7 how to insert, update, delete data
Updating
o Does all but nothing
Insert
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents