SQL Basics

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsDatabasesSQL Basics

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old November 16th, 2015, 05:26 PM
Mr. Meeseeks Mr. Meeseeks is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Nov 2015
Posts: 1 Mr. Meeseeks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 39 sec
Reputation Power: 0
Help with query

I am pretty new to query and have some query code I created and was wondering if anyone could help see what is wrong. Any help would be great.

SELECT * FROM customer;
SELECT * FROM orders;
SELECT * FROM product;
SELECT * from lineitem;
set echo on;

alter session set nls date format='dd-mon-yy hh24:mi'

drop table lineitem;
drop table product;
drop table orders;
drop table customer;

create table customer
(
id char(5) primary key,
fname char(15),
lname char(15),
bday date,
phone char(12)
);

create table orders
(
id char(5),
CUSTOMER$id char(5) primary key refereces customer (id),
xdate date,
delivery char(10),
wrap char(1)
);

create table product
(
id char(5) primary key,
list_price number,
description char(20)
);

create table lineitem
(
ORDER$id char(5 primary key),
PRODUCT$id char(5) reference order (id),
quantity number,
sale_price number references product (list_price)
);

select table_name from user_tables;

describe customer;
describe order;
describe product;
describe lineitem;

insert into customer (id, fname, lname, bday, phone) values
(11111, Glen, Stamler, '13-Sept-1974', 555-3232);
(22222, Maddy, Gray, '05-Aug-1984', 555-8475);
(33333, Blake, Shelton, '25-Jul-1975', 555-4875);
(44444, EJ, Thorton, '04-feb-1988', 555-9845);

insert into orders (id, CUSTOMER$id, date, delivery, wrap) values
(10000, 11111, '04-feb-2003', n, n);
(10001, 22222, '05-feb-2003', y,y);
(10002, 11111, '05-feb-2003', n, n);
(10003, 33333, '06-feb-2003', y, n);

insert into product (id, list_price, description) values
(00001, 15.95, lager);
(00002, 25.24, stout);
(00003, 13,95, light);
(00004, 19.98, pilsner);
(00005, 18.75, microbrew);
(00006, 18.57, ale);
(00007, 15.95, bock);
(00008, 19.95, porter);

insert into lineitem (ORDER$id, PRODUCT$id, quantity, sale_price) values
(10000, 00001, 1, 15.75);
(10000, 00003, 2, 13.95);
(10001, 00002, 1, 23.95);
(10001, 00005, 1, 18.50);
(10002, 00008, 3, 21.75);
(10003, 00006, 1, 18.35);
(10003, 00001, 2, 15.95);
(10003, 00003, 1, 12.95);
(10003, 00004, 1, 19.98);

SELECT * FROM orders;
SELECT * FROM product;
SELECT * FROM customer;
SELECT * FROM lineitem;


COMMIT;

Reply With Quote
Reply

Viewing: Tutorialized ForumsDatabasesSQL Basics > Help with query


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap