Tasks 10-12 Task 10: List all the tables contained within the system catalog, but only display the first 10 records with a TABLE_TYPE of SYSTEM VIEW. Task 11: List all the columns contained within the system catalog, but only display the first 11 records that are in the KimTay TABLE_SCHEMA.  Task 12: List all the views contained within the system catalog, but only display the first 12 records.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I am having trouble with Tasks 10-12

Task 10: List all the tables contained within the system catalog, but only display the first 10 records with a TABLE_TYPE of SYSTEM VIEW.

Task 11: List all the columns contained within the system catalog, but only display the first 11 records that are in the KimTay TABLE_SCHEMA. 

Task 12: List all the views contained within the system catalog, but only display the first 12 records.

 

I have done Tasks 1-9

Here is the formula for Tasks 1-9

TASK 1.

 

CREATE VIEW MAJOR_CUSTOMER AS

SELECT CUST_ID,FIRST_NAME,LAST_NAME, BALANCE, CREDIT_LIMIT, REP_ID

FROM CUSTOMER

WHERE CREDIT_LIMIT <= 500 ;

NEW QUERY

SHOW FULL TABLES WHERE table_type = 'VIEW' and tables_in_KimTay = 'MAJOR_CUSTOMER'

 

TASK 2.
 

SELECT CUST_ID,FIRST_NAME,LAST_NAME

FROM MAJOR_CUSTOMER

WHERE BALANCE > CREDIT_LIMIT ;

 

TASK 3.
 

SELECT CUST_ID,FIRST_NAME,LAST_NAME 

FROM CUSTOMER

WHERE CREDIT_LIMIT <= 500 ;

 

TASK 4.
 

CREATE VIEW ITEM_INVOICE AS

SELECT C.ITEM_ID AS ITEM_ID, DESCRIPTION, PRICE, C.INVOICE_NUM AS INVOICE_NUM, 

INVOICE_DATE, QUANTITY, QUOTED_PRICE

FROM CUSTOMER A INNER JOIN INVOICES B ON A.CUST_ID = B.CUST_ID

INNER JOIN INVOICE_LINE C ON C.INVOICE_NUM = B.INVOICE_NUM

INNER JOIN ITEM D ON D.ITEM_ID = C.ITEM_ID ;

NEW QUERY

SHOW FULL TABLES WHERE table_type = 'VIEW' AND tables_in_KimTay = 'ITEM_INVOICE'

 

TASK 5
 

SELECT ITEM_ID, DESCRIPTION, INVOICE_NUM, QUOTED_PRICE 

FROM ITEM_INVOICE WHERE QUOTED_PRICE > 100; 

 

TASK 6
 

SELECT C.ITEM_ID AS ITEM_ID, DESCRIPTION, PRICE, C.INVOICE_NUM AS INVOICE_NUM, 

INVOICE_DATE, QUANTITY, QUOTED_PRICE

FROM CUSTOMER A INNER JOIN INVOICES B ON A.CUST_ID = B.CUST_ID

INNER JOIN INVOICE_LINE C ON C.INVOICE_NUM = B.INVOICE_NUM 

INNER JOIN ITEM D ON D.ITEM_ID = C.ITEM_ID 

WHERE QUOTED_PRICE > 100 ;

 

 

TASK 7.
 

CREATE VIEW INVOICE_TOTAL AS

SELECT C.INVOICE_NUM AS INVOICE_NUM, SUM(QUANTITY * QUOTED_PRICE ) AS TOTAL_AMOUNT 

FROM CUSTOMER A INNER JOIN INVOICES B ON A.CUST_ID = B.CUST_ID

INNER JOIN INVOICE_LINE C ON C.INVOICE_NUM = B.INVOICE_NUM

INNER JOIN ITEM D ON D.ITEM_ID = C.ITEM_ID 

GROUP BY C.INVOICE_NUM ORDER BY C.INVOICE_NUM;

NEW QUERY

SHOW FULL TABLES WHERE table_type = 'VIEW' and tables_in_KimTay = 'INVOICE_TOTAL'

 

TASK 8 
 

SELECT INVOICE_NUM, TOTAL_AMOUNT

FROM INVOICE_TOTAL 

WHERE TOTAL_AMOUNT > 250 ;

 

TASK 9

SELECT INVOICE_NUM, SUM((QUANTITY * QUOTED_PRICE)) TOTAL FROM INVOICE_LINE

GROUP BY INVOICE_NUM

HAVING SUM((QUANTITY * QUOTED_PRICE)) > 250;

 

 

 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Task 10

Task 10: List all the tables contained within the system catalog, but only display the first 10 records with a TABLE_TYPE of SYSTEM VIEW.

Results

SELECT * FROM (SELECT TABLE_NAME
FROM ALL_TABLES 
ORDER BY TABLE_NAME)
WHERE ROWNUM < = 10;
ERROR 1248 (42000) at line 1: Every derived table must have its own alias
 
Task 11 Results
 
Task 11: List all the columns contained within the system catalog, but only display the first 11 records that are in the KimTay TABLE_SCHEMA. 
 
 
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
SQL Query
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education