Advertisement

08.27.2008 at 12:39PM PDT, ID: 23683300
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

query help

Asked by pablo25 in Oracle 10.x, Databases Miscellaneous, Oracle Database

SELECT first_name FROM CUSTOMER, ORDERS, ORDER_INSTRUMENTS
WHERE CUSTOMER.CUSTOMER_ID = ORDERS.CUSTOMER_ID  AND ORDERS.ID = ORDER_INSTRUMENTS.ORDER_ID AND ORDER_INSTRUMENTS.TOTAL_AMT = 1299.99


HI CAN SOMEBODY HELP ME WITH SOME QUERIES - HERE I AM TRYING TO RETRIEVE THE FIRST NAMES OF THE PEOPLE THAT SPENT 1299.99Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
DROP TABLE shopkeeper CASCADE CONSTRAINTS;
DROP TABLE role CASCADE CONSTRAINTS;
DROP TABLE customer CASCADE CONSTRAINTS;
DROP TABLE orders CASCADE CONSTRAINTS;
DROP TABLE order_instruments CASCADE CONSTRAINTS;
DROP TABLE instrument CASCADE CONSTRAINTS;
DROP TABLE instrument_category CASCADE CONSTRAINTS;
 
 
 
 
 
 
CREATE OR REPLACE TYPE ADDRESS AS OBJECT(
line1 VARCHAR2(30), 
line2 VARCHAR2(30), 
line3 VARCHAR2(30));
 
 
CREATE OR REPLACE TYPE CONTACT AS OBJECT(
email VARCHAR2(30), 
phone NUMBER(15));
 
 
 
CREATE TABLE SHOPKEEPER
(shop_id NUMBER(10),
name VARCHAR2(30),
role_id VARCHAR2(3),
CONSTRAINT pk_sk_id PRIMARY KEY (shop_id),
CONSTRAINT fk_sk_role_id FOREIGN KEY (role_id) REFERENCES ROLE(id));
 
 
 
CREATE TABLE ROLE
(id VARCHAR2(3),
name VARCHAR2(30),
CONSTRAINT pk_role_id PRIMARY KEY(id));
 
 
 
CREATE TABLE CUSTOMER
(customer_id NUMBER(10), 
first_name VARCHAR2(10), 
last_name VARCHAR2(15),
cus_address ADDRESS,
cus_contact CONTACT,
CONSTRAINT pk_cud_id PRIMARY KEY (customer_id));
 
 
 
CREATE TABLE ORDERS
(id NUMBER(10),
customer_id NUMBER(10),
created TIMESTAMP(6),
CONSTRAINT pk_order_id PRIMARY KEY (id),
CONSTRAINT fk_custm_id FOREIGN KEY (customer_id) REFERENCES CUSTOMER(customer_id));
 
 
CREATE TABLE ORDER_INSTRUMENTS
(id NUMBER(10),
order_id NUMBER(10),
number_of_instruments NUMBER(10),
product_id VARCHAR2(13),
total_amt NUMBER(8,2),
CONSTRAINT pk_order_instrum_id PRIMARY KEY (id),
CONSTRAINT fk_prod_id FOREIGN KEY (product_id) REFERENCES INSTRUMENT(instrmt_code),
CONSTRAINT fk_order_id FOREIGN KEY (order_id) REFERENCES ORDERS(id);
 
 
CREATE TABLE INSTRUMENT
(instrmt_code VARCHAR(13),
name VARCHAR(30),
instrument_type VARCHAR(40),
price NUMBER(8,2),
brand VARCHAR(30),
stock_level NUMBER(4),
CONSTRAINT pk_instrmt_id PRIMARY KEY (instrmt_code),
CONSTRAINT fk_inst_type FOREIGN KEY (instrument_type) REFERENCES INSTRUMENT_CATEGORY(id));
 
 
CREATE TABLE INSTRUMENT_CATEGORY
(id VARCHAR2(40),
name VARCHAR2(30),
CONSTRAINT pk_instrument_cat PRIMARY KEY (id));
 
 
 
 
 
ALTER TABLE `orders` ADD `order_date` 
TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL;
 
 
 
 
INSERT INTO shopkeeper VALUES
('1234','PAUL PATTEN','MGR');
 
INSERT INTO shopkeeper VALUES
('4567','DENIS PATTEN','AMG');
 
INSERT INTO shopkeeper VALUES
('6789','PATRICK PATTEN','CLK'); 
 
 
 
 
 
 
INSERT INTO role VALUES
('MANAGER','STORE MANAGER');
 
 
INSERT INTO role VALUES
('ASSISTANT MANAGER','ASSISTANT STORE MANAGER');
 
 
INSERT INTO role VALUES
('CLERK','STORE ASSISTANT');
 
 
 
 
 
 
 
INSERT INTO customer VALUES
('666999', 'LENNY','KRAVITZ', ADDRESS('101 PLAZA','SUNSET BLVD', 'CALIFORNIA'), CONTACT('LENNY@KRAVITZ.COM','12548222'));
 
INSERT INTO customer VALUES 
('333666', 'JIMMY', 'HENDRIX', ADDRESS('102 PLAZA','RODEO BLVD', 'CALIFORNIA'), CONTACT('JIMMY@HENDRIX.COM','125444422'));
 
INSERT INTO customer VALUES
('222444', 'LARRY', 'MULLEN', ADDRESS('133 PLAZA','Malahide', 'DUBLIN'), CONTACT('LARRY@MULLEN.COM','1254654577'));
 
INSERT INTO customer VALUES
('444888', 'LOUIS', 'ARMSTRONG', ADDRESS('410 PLAZA','BOURBON STREET', 'NEW ORLEANS'), CONTACT('LOUIS@ARMSTRONG.COM','45458555'));
 
INSERT INTO customer VALUES
('555111', 'ADAM', 'CLAYTON', ADDRESS('753 PLAZA','DALKEY', 'DUBLIN'), CONTACT('ADAM@CLAYTON.COM','1411892'));
 
INSERT INTO customer VALUES
('111999', 'ERIC', 'CLAPTON', ADDRESS('262 PLAZA','LITTLE ROCK', 'ARKANSAS'), CONTACT('ERIC@CLAPTON.COM','12546999'));
 
INSERT INTO customer VALUES
('777333', 'JULIO', 'IGLESIAS', ADDRESS('212 PLAZA','PEREZ COURT', 'CALIFORNIA'), CONTACT('JULIO@IGLESIAS.COM','5547988'));
 
 
 
 
 
 
 
 
 
INSERT INTO orders VALUES
('121212', '666999', CURRENT_TIMESTAMP);
 
INSERT INTO orders VALUES
('232323', '333666', CURRENT_TIMESTAMP);
 
INSERT INTO orders VALUES
('454545', '222444', CURRENT_TIMESTAMP);
 
INSERT INTO orders VALUES
('787878', '444888', CURRENT_TIMESTAMP);
 
INSERT INTO orders VALUES
('363636', '111999,  CURRENT_TIMESTAMP);
 
INSERT INTO orders VALUES
('171717', '777333', CURRENT_TIMESTAMP);
 
 
 
 
 
 
 
 
INSERT INTO order_instruments VALUES
('9999999', '121212', '1', 'GUITARQWQ','799.99');
 
INSERT INTO order_instruments VALUES
('8888888', '232323', '1', 'GUITARLEP','859.99');
 
INSERT INTO order_instruments VALUES
('7777777', '454545', '1', 'DRUMKTZ',  '1299.99');
 
INSERT INTO order_instruments VALUES
('6666666', '787878', '1', 'TRUMPTBLW','439.99');
 
INSERT INTO order_instruments VALUES
('5555555', '363636', '1', 'ACOUSTRZR','250.00');
 
INSERT INTO order_instruments VALUES
('2222222', '171717', '2', 'SPANISSHZ','540.00');
 
 
 
 
 
 
 
 
 
INSERT INTO instrument VALUES
('GUITARQWQ', 'TELECASTER', 'ELECTRIC GUITAR', '799.99', 'FENDER', '14');
  
INSERT INTO instrument VALUES
('GUITARLEP', 'LES PAUL', 'ELECTRIC GUITAR', '859.99', 'LES PAUL', '7');
 
INSERT INTO instrument VALUES 
('ACOUSTRZR', 'RAZOR', 'ACOUSTIC GUITAR', '250.00', 'SOUNDMAKER', '4');
 
INSERT INTO instrument VALUES 
('SPANISSHZ', 'SANCHEZ', 'SPANISH GUITAR', '270.00' 'LE GUEVERA', '3');
 
INSERT INTO instrument VALUES
('DRUMKTZ', 'MARQUET', 'CLASSIC DRUMS', '1299.99', 'MARSHALL', '5');
 
INSERT INTO instrument VALUES
('TRUMPTBLW', 'BONET', 'TRUMPET', '439.99', 'VON NEUMANN BRASS', '4');
 
 
 
 
 
 
 
 
INSERT INTO instrument_category VALUES
('ELECTRIC GUITAR', 'GUITAR');
 
INSERT INTO instrument_category VALUES
('ACOUSTIC GUITAR', 'GUITAR');
 
INSERT INTO instrument_category VALUES
('SPANISH GUITAR', 'GUITAR');
 
INSERT INTO instrument_category VALUES
('CLASSIC DRUMS', 'DRUMS');
 
INSERT INTO instrument_category VALUES
('TRUMPET', 'BRASS');
[+][-]08.27.2008 at 12:53PM PDT, ID: 22328540

View this solution now by starting your 14-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Oracle 10.x, Databases Miscellaneous, Oracle Database
Sign Up Now!
Solution Provided By: gatorvip
Participating Experts: 2
Solution Grade: A
 
 
[+][-]08.27.2008 at 12:55PM PDT, ID: 22328557

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 14-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]08.27.2008 at 01:04PM PDT, ID: 22328632

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.27.2008 at 01:11PM PDT, ID: 22328694

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-43 / EE_QW_2_20070628