
Oracle 12c: SQL
3rd Edition
ISBN: 9781305251038
Author: Joan Casteel
Publisher: Cengage Learning
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
thumb_up100%
INFO 2103
Assignment #3
For this assignment, please use the SUPPLIER and COMPUTER table. The script is available in Google Classroom. Script name: computer.sql. Note: Use Subqueries
1. Display the supplier that supplied the most computers.
2. Display the building location that has the most computers.

Transcribed Image Text:DROP TABLE computer CASCADE CONSTRAINTS,
DROP TABLE location CASCADE CONSTRAINTS;
DROP TABLE supplier CASCADE CONSTRAINTS:
CREATE TABLE supplier
(SuppID NUMBER (3),
SName VARCHAR2 (15),
SAddress VARCHAR2 120),
SPhone VARCHAR2 (12),
CONSTRAINT supplier_suppID_PK PRIMARY KEY (suppIDI);
CREATE TABLE location
(LocID NUMBER (3),
Bldg_code CHAR (4),
RoonNo NUMNBER (3),
CONSTRAINT location locid PK PRIMARY KEY (LOCID) I:
CREATE TABLE computer
(CompID NUMBER (5),
SNumber VARCHAR2 (15),
Make VARCHAR2 (20),
SuppID NUMBER (3),
LocID NUMBER (3),
Value NUMBER (6,2),
Date purchased DATE,
CONSTRAINT computer_compID_PK PRIMARY KEY (CompID),
CONSTRAINT computer_suppID_FK FOREIGN KEY (suppID) REFERENCES
supplier,
CONSTRAINT computer 10CID FK FOREIGN KEY (10CID) REFERENCES location) :
INSERT INTO supplier VALUES (122, 'Compag Sdn. Bhd', '10 Jalan Duta',
'03-989898');
INSERT INTO supplier VALUES (123, 'ASUS Sdn. Bhd', '12 Jalan Duta',
'03-2323231;
INSERT INTO supplier VALUES (124, 'IBM Sdn.Bhd', '15 Jalan Duta', '03-
565656'):
INSERT INTO supplier VALUES (125, 'Apple Sdn.Bhd', '18 Jalan Duta',
'03-785676')
INSERT INTO location VALUES (222, 'LAN', 343):
INSERT INTO location VALUES (333, 'IRK', 343)
INSERT INTO location VALUES (444, 'ICT', 343)
INSERT INTO computer VALUES (13321, "XDX12345', "Compaq', 122, 222,
2300.50, 70 DATE ('12-JAN-2008', 'DD-MON-YYYY')):
INSERT INTO computer VALUES (13322, 'XDX12344', 'ASUS PC', 123, 222,
3000.80, TO DATE ('17-JAN-2008', 'DD-MON-YYYY')):
INSERT INTO Computer VALUES (13323, "XDX12343', 'IBM', 124, 333,
2800.50, TO_DATE ('12-DEC-2008', 'DD-MON-YYYY'));
INSERT INTO computer VALUES (13324, "XDX12342', 'Apple', 125, 444,
5300.50, TO_DATE ('12-JUN-2009', 'DD-MON-YYYY')) :
INSERT INTO computer VALUES (13325, "XDX12341', 'Apple', 125, 444,
6300.50, T0 DATE ('12-JUN-2009', 'DD-MON-YYYY')):
INSERT INTO computer VALUES (13326, "XDX12346', 'Apple', 125, 444,
6000.85, 70 DATE ('12-JUN-2009', 'DD-MON-YYYY')):
COMMITI
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps with 2 images

Knowledge Booster
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
- You’re creating a new table consisting of three columns: Col1, Col2, and Col3. Col1 should be the primary key and can’t have any NULL values, and each entry should be unique. Col3 must not contain any NULL values either. How many total constraints do you have to create? 1 2 3 4arrow_forwardProblems 27 and 28 are based on the following query: SELECT P_CODE, P_DESCRIPT, P_QOH, P_PRICE, V_CODE FROM PRODUCT WHERE P_QOH P_MIN AND P_MIN = P_REORDER AND P_REORDER = 50 ORDER BY P_QOH; What indexes would you recommend? Write the commands to create those indexes.arrow_forwardCreate a table named REP_CONTRACTS containing the columns listed in the following chart A composite PRIMARY KEY constraint including the Rep_ID, Store_ID, and Quarter columns should be assigned. In addition, FOREIGN KEY constraints should be assigned to both the Rep_ID and Store_ID columns.arrow_forward
- Which type of constraint can be used to make certain the category for a book is included when a new book is added to inventory?arrow_forwardProblems 2224 are based on the following query: SELECT P_CODE, P_DESCRIPT, P_PRICE, P.V_CODE, V_STATE FROM PRODUCT P, VENDOR V WHERE P.V_CODE = V.V_CODE AND V_STATE = 'NY' AND V_AREACODE = '212' ORDER BY P_PRICE; Write the command(s) used to generate the statistics for the PRODUCT and VENDOR tables.arrow_forwardProblems 2932 are based on the following query: SELECT CUS_CODE, MAX(LINE_UNITSLINE_PRICE) FROM CUSTOMER NATURAL JOIN INVOICE NATURAL JOIN LINE WHERE CUS_AREACODE = '615' GROUP BY CUS_CODE; How would you rewrite the query to ensure that the index you created in Problem 31 is used?arrow_forward
- Review the data for the TRIP table in Figure 1-5 in Chapter 1 and then review the data types used to create the TRIP table in Figure 3-39. Suggest alternate data types for at least two fields that currently have the CHAR data type and at least two fields that currently have the DECIMAL data type. Create but do not execute the SQL command to create the TRIP table using these alternate data types.arrow_forwardProblems 25 and 26 are based on the following query: SELECT P_CODE, P_DESCRIPT, P_QOH, P_PRICE, V_CODE FROM PRODUCT WHERE V_CODE = '21344' ORDER BY P_CODE; How should you rewrite the query to ensure that it uses the index you created in your solution to Problem 25?arrow_forwardUsing tables named T1 and T2, write a query example for each of the three join types you described in Question 2. Assume that T1 and T2 share a common column named Cl.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781305627482Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781285196145Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos CoronelPublisher:Cengage Learning
- Np Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:CengageA Guide to SQLComputer ScienceISBN:9781111527273Author:Philip J. PrattPublisher:Course Technology Ptr


Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781305627482
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781285196145
Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage

A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr