Question
Currently working on SQL homework, and getting errors in my code. I thought it looked right, but Im still learning SQL and Oracle. Can someone
Currently working on SQL homework, and getting errors in my code. I thought it looked right, but Im still learning SQL and Oracle. Can someone please help me fix it, and explain where I went wrong?
create table Base( Basenum char(3), Basecity varchar2(20), Basestate char(2), Basephone varchar2(10), Basemgr varchar2(10), primary key(Basenum)); create table Type( Typenum char(1), TypeDesc varchar2(30), Primary key(Typenum)); create table Truck( Tnum char(4), Basenum char(3), Typenum char(1), Tmiles Number(7,1) Tbought date, Tserial varchar2(20), Primary key(Tnum), Foreign key(Basenum) references Base(Basenum) Foreign Key(Typenum) references Type(Typenum)); Insert into Base(Basenum,Basecity,Basestate,BasePhone,Basemgr) values (501,"Dallas",'TX',"893-9870","J.Jones"); Insert into Base(Basenum,Basecity,Basestate,BasePhone,Basemgr) values (502,"New York",'NY',"234-7689","K.Lee"); Insert into Type(Typenum,TypeDesc) values (1,"Single box,Double axle"); Insert into Type(Typenum,TypeDesc) values (2,"Tandem trailer,Single axle"); Insert into Truck(Tnum,Basenum,Typenum,Tmiles,Tbought,Tserial) values (1001,501,1,5900.2,'11/08/90',"aa-125"); Insert into Truck(Tnum,Basenum,Typenum,Tmiles,Tbought,Tserial) values (1002,502,2,64523.9,'11/08/90',"ac-213"); Insert into Truck(Tnum,Basenum,Typenum,Tmiles,Tbought,Tserial) values (1003,501,2,32116.0,'09/29/91',"ac-215"); Insert into Truck(Tnum,Typenum,Tmiles,Tbought,Tserial) values (1004,2,3256.9,'01/14/92',"ac-315"); Select Tnum, Tbought, Tmiles, Tserial from Truck Select t.Tnum, t.Tbought, t.Tmiles, b.Basenum, b.Basecity from Truck t join Base b on b.Basenum = t.Basenum where b.Basecity = "Dallas" order by t.Tnum;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started