Home » SQL & PL/SQL » SQL & PL/SQL » need help with basic sql
need help with basic sql [message #326253] Tue, 10 June 2008 21:14 Go to next message
jlopez85
Messages: 4
Registered: June 2008
Location: STUDENT
Junior Member
i am a student and trying to figure this out i have to create a golf database that will show the lengths (between the tee location and the location of the hole) for each hole from each of four tees(long, medium, short, womens. this is what i have so far:

create table course
(courseid number primary key,
coursename varchar2(25) not null,
coursestate char(2),
coursecity varchar2(25),
courseaddress varchar2(25),
coursezip varchar2(10),
coursephonenumber varchar2(20),
courselength varchar2(10));

insert into course
values (1,'Bramble Ridge','TX','Housten','3565 Bannana Peel Way','44102','(863) 668-6655');
insert into course
values (2,'Cleveland Heights','FL','Lakeland','3433 Winterlake rd','33803','(281) 531-2598','5215');
insert into course
values (3,'The Crimson Tide Golf Course','AL','Tuscaloosa','3326 Big Elephant rd','33813','(206) 348-5454','4890');


create table tee
(teeid number primary key,
teeshortlength varchar 2(4),
teemediumlength varchar 2(4),
teelonglength varchar 2(4),
teewomenlength varchar 2(4),
holeid number references hole(holeid));

insert into tee values (1,'400','450','480','300',1);
insert into tee values (2,'100','190','240','80',2);
insert into tee values (3,'200','230','278','175',3);
insert into tee values (4,'315','380','455','185',4);
insert into tee values (5,'250','280','300','210',5);
insert into tee values (6,'375','390','420','310',6);
insert into tee values (7,'500','520','550','380',7);
insert into tee values (8,'325','355','398','450',8);
insert into tee values (9,'280','300','310','235',9);
insert into tee values (10,'275','295','355','210',10);
insert into tee values (11,'180','190','200','165',11);
insert into tee values (12,'230','260','290','200',12);
insert into tee values (13,'300','330','360','280',13);
insert into tee values (14,'175','190','220','110',14);
insert into tee values (15,'280','295','320','210',15);
insert into tee values (16,'115','160','210','100',16);
insert into tee values (17,'225','235','290','169',17);
insert into tee values (18,'480','495','515','440',18);
insert into tee values (19,'265','280','290','313',19);
insert into tee values (20,'288','305','335','265',20);
insert into tee values (21,'189','199','206','135',21);
insert into tee values (22,'319','342','370','283',22);
insert into tee values (23,'265','280','293','235',23);
insert into tee values (24,'315','345','375','299',24);
insert into tee values (25,'260','270','280','250',25);
insert into tee values (26,'290','325','345','275',26);
insert into tee values (27,'225','245','275','175',27);
insert into tee values (28,'320','350','260','315',28);
insert into tee values (29,'260','270','280','235',29);
insert into tee values (30,'255','270','280','240',30);
insert into tee values (31,'272','294','320','260',31);
insert into tee values (32,'315','335','365','290',32);
insert into tee values (33,'335','350','360','275',33);
insert into tee values (34,'252','285','290','210',34);
insert into tee values (35,'312','335','355','305',35);
insert into tee values (36,'260','290','310','230',36);
insert into tee values (37,'123','154','167','98',37);
insert into tee values (38,'325','343','365','315',38);
insert into tee values (39,'230','240','250','210',39);
insert into tee values (40,'190','200','225','165',40);
insert into tee values (41,'140','175','199','108',41);
insert into tee values (42,'315','332','345','275',42);
insert into tee values (43,'290','315','330','270',43);
insert into tee values (44,'270','290','300','240',44);
insert into tee values (45,'233','285','315','210',45);
insert into tee values (46,'301','315','343','292',46);
insert into tee values (47,'200','222','235','195',47);
insert into tee values (48,'285','295','305','265',48);
insert into tee values (49,'205','216','239','195',49);
insert into tee values (50,'230','240','250','220',50);
insert into tee values (51,'235','245','255','215',51);
insert into tee values (52,'210','230','260','203',52);
insert into tee values (53,'260','285','293','220',53);
insert into tee values (54,'330','370','390','300',54);

create table hole
(holeid number primary key,
holenumber varchar 1(2),
holelength varchar 2(4),
courseid number references course(courseid));

insert into hole values (1,'1','250',1);
insert into hole values (2,'2','175',1);
insert into hole values (3,'3','200',1);
insert into hole values (4,'4','225',1);
insert into hole values (5,'5','265',1);
insert into hole values (6,'6','325',1);
insert into hole values (7,'7','205',1);
insert into hole values (8,'8','235',1);
insert into hole values (9,'9','305',1);
insert into hole values (10,'10','285',1);
insert into hole values (11,'11','210',1);
insert into hole values (12,'12','250',1);
insert into hole values (13,'13','330',1);
insert into hole values (14,'14','220',1);
insert into hole values (15,'15','280',1);
insert into hole values (16,'16','195',1);
insert into hole values (17,'17','215',1);
insert into hole values (18,'18','310',1);
insert into hole values (19,'1','275',2);
insert into hole values (20,'2','305',2);
insert into hole values (21,'3','300',2);
insert into hole values (22,'4','315',2);
insert into hole values (23,'5','295',2);
insert into hole values (24,'6','265',2);
insert into hole values (25,'7','280',2);
insert into hole values (26,'8','290',2);
insert into hole values (27,'9','225',2);
insert into hole values (28,'10','320',2);
insert into hole values (29,'11','260',2);
insert into hole values (30,'12','255',2);
insert into hole values (31,'13','270',2);
insert into hole values (32,'14','325',2);
insert into hole values (33,'15','335',2);
insert into hole values (34,'16','250',2);
insert into hole values (35,'17','310',2);
insert into hole values (36,'18','340',2);
insert into hole values (37,'1','250',3);
insert into hole values (38,'2','325',3);
insert into hole values (39,'3','260',3);
insert into hole values (40,'4','190',3);
insert into hole values (41,'5','180',3);
insert into hole values (42,'6','335',3);
insert into hole values (43,'7','290',3);
insert into hole values (44,'8','270',3);
insert into hole values (45,'9','305',3);
insert into hole values (46,'10','315',3);
insert into hole values (47,'11','265',3);
insert into hole values (48,'12','285',3);
insert into hole values (49,'13','215',3);
insert into hole values (50,'14','230',3);
insert into hole values (51,'15','235',3);
insert into hole values (52,'16','290',3);
insert into hole values (53,'17','300',3);
insert into hole values (54,'18','350',3);



how can i compress or combine some of the values for the tee?
Re: need help with basic sql [message #326261 is a reply to message #326253] Tue, 10 June 2008 22:26 Go to previous messageGo to next message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
>how can i compress or combine some of the values for the tee?
Why do you want to do this?
Are you being charged by the character?
What would be gained if you succeeded to compress or combine values?

Good Luck with your homework assignment.
Re: need help with basic sql [message #326265 is a reply to message #326253] Tue, 10 June 2008 23:05 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
how can i compress or combine some of the values for the tee?

What does this mean exactly?

Regards
Michel
Re: need help with basic sql [message #326434 is a reply to message #326253] Wed, 11 June 2008 08:04 Go to previous messageGo to next message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
jlopez85 wrote on Tue, 10 June 2008 22:14



create table tee
(teeid number primary key,
teeshortlength varchar 2(4),
teemediumlength varchar 2(4),
teelonglength varchar 2(4),
teewomenlength varchar 2(4),
holeid number references hole(holeid));



create table hole
(holeid number primary key,
holenumber varchar 1(2),
holelength varchar 2(4),
courseid number references course(courseid));



These are not valid create table statements in Oracle.
Re: need help with basic sql [message #326445 is a reply to message #326434] Wed, 11 June 2008 09:28 Go to previous message
Olivia
Messages: 519
Registered: June 2008
Senior Member
Just Wondering how one can proceed for insert before tables being created!!

varchar 1(2) is not valid!!

Regards,
Oli
Previous Topic: Case Expression used in Select Statement
Next Topic: Viewing the errors on a procedure
Goto Forum:
  


Current Time: Sat Dec 03 06:17:51 CST 2016

Total time taken to generate the page: 0.07031 seconds