Home » SQL & PL/SQL » SQL & PL/SQL » very newb question on creating a table
very newb question on creating a table [message #229980] Tue, 10 April 2007 08:22 Go to next message
Syix
Messages: 5
Registered: April 2007
Junior Member
Hi - my professor wants us to create a table and ive been ttrying to figure out how... as we have just begun the class... the instructions for the assignment are as follows:

a. Create table NEWDEPT with the following fields
i. Deptid, primary key of integer type (2 digits)
ii. DeptName, variable string up to 12 characters
iii. Location, variable sring up to 12 characters

b. Populate the NEWDEPT table with the following records
i. 10, Finance, Charlotte
ii. 20, InfoSys, New York
iii. 30, Sales, Woodbridge
iv. 40, Marketing, Los Angeles



so as you see i have to create a table like that and ive been playin around and cant quite figure it out as im new to oracle and all sql stuff hehe ... sorry to ask a question right off the bat. But i hate struggling with this stuff. if someone could show me how to do this it would be great! cause im interested in actually learning this stuff for my future - thanks all.. and hello =)
Re: very newb question on creating a table [message #229984 is a reply to message #229980] Tue, 10 April 2007 08:25 Go to previous messageGo to next message
Cthulhu
Messages: 381
Registered: September 2006
Location: UK
Senior Member
This forum is not really intended for people doing courses. In any case, you should be able to figure it out yourself from the course notes provided.
Re: very newb question on creating a table [message #229989 is a reply to message #229984] Tue, 10 April 2007 08:38 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
Kudos for not mocking about and for telling us that this is an assignment. You might want to check out the SQL FAQ.

MHE
Re: very newb question on creating a table [message #229993 is a reply to message #229980] Tue, 10 April 2007 08:44 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Hm, if you already hate doing this, you may be in for some nasty surprises during this course...
Good luck, you're going to need it!
Re: very newb question on creating a table [message #230028 is a reply to message #229993] Tue, 10 April 2007 12:31 Go to previous messageGo to next message
Syix
Messages: 5
Registered: April 2007
Junior Member
well thanks guys... just thought i would ask... still playin with it though... as i am very new.
Re: very newb question on creating a table [message #230029 is a reply to message #229980] Tue, 10 April 2007 12:41 Go to previous messageGo to next message
Bill B
Messages: 1484
Registered: December 2004
Senior Member
It is not that we won't help, it's just that we won't do your homework. If you made a real effort and show us what you tried that failed, we will probably help. However, just saying (in effect) that you want to be spoon fed the answer will not generate any help.
Re: very newb question on creating a table [message #230092 is a reply to message #229980] Tue, 10 April 2007 20:01 Go to previous messageGo to next message
Syix
Messages: 5
Registered: April 2007
Junior Member
ok so so far i have:


Create Table NewDept (
DeptId INTEGER NOT NULL,
DeptName Varchar2(12),
Location Varchar2(12),
CONSTRAINT pk_NewDept Primary Key (DeptID));

INSERT INTO NewDept Values (10, 'Finance', 'Charlotte');
INSERT INTO NewDept values (20, 'SysInfo', 'New York');
INSERT INTO NewDept values (30, 'Sales', 'WoodBridge');
INSERT INTO NewDept Values (40, 'Marketing', 'Los Angeles');

Declare
DeptIDsearch int;
Cursor DeptCursor IS
SELECT DeptName, Location
FROM NewDept
WHERE DeptID = DeptidsEARCH;
dEPTrec dEPTcURSOR%ROWTYPE;
BEGIN
DeptIDSearch := 40;
FOR DeptRec IN DeptCursor LOOP
DBMS_OUTPUT.PUT_LINE('The location of the ' || DeptRec.DeptName ||
'Department is in" || DeptRec.Locatoin || '-');
END LOOP;
END;





ok now i got all that... and it worked out fine... now after that it doenst go back to the mysql prompt it just keeps on going down lines... im suppose to screen capture this... and i dunno how if i dont even know how to get it to complete... any suggestions? thanks for your time!

Re: very newb question on creating a table [message #230093 is a reply to message #229980] Tue, 10 April 2007 20:09 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
>now after that it doenst go back to the mysql prompt
PLEASE tell us the line above is a typo.
MYSQL prompt????????????????????????????


>im suppose to screen capture this... and i dunno how if i dont even know how to get it to complete...
Try adding "/" (without the double quote marks) on a new line after the bottom most "END;" line

start you session by issuing the "cmd" command in the "run" dialog box to create a dumb terminal like interface to Windoze.
Re: very newb question on creating a table [message #230344 is a reply to message #229980] Wed, 11 April 2007 10:56 Go to previous messageGo to next message
Syix
Messages: 5
Registered: April 2007
Junior Member
ya that was kinda typo... i ment a new line lol... didnt get much sleep last night.... tryed the "/" and it didnt work... says quoted string not properly terminated... i dunno.
Re: very newb question on creating a table [message #230346 is a reply to message #229980] Wed, 11 April 2007 11:09 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
>'Department is in" || DeptRec.Locatoin || '-');
Possibly because of the double quote instead of single quote in line above?
Re: very newb question on creating a table [message #230383 is a reply to message #229980] Wed, 11 April 2007 13:40 Go to previous message
Syix
Messages: 5
Registered: April 2007
Junior Member
ahhh you are right... i was playin with that in class and actually figured that out lol... but thanks hehe... sorry to bug you all... take it easy! and thanks again
Previous Topic: SQL Query
Next Topic: Materialized View
Goto Forum:
  


Current Time: Thu Dec 08 19:54:50 CST 2016

Total time taken to generate the page: 0.06485 seconds