• Best of luck to the class of 2024 for their HSC exams. You got this!
    Let us know your thoughts on the HSC exams here
  • YOU can help the next generation of students in the community!
    Share your trial papers and notes on our Notes & Resources page
MedVision ad

SQL Question (1 Viewer)

exa_boi87

aka biomic
Joined
Apr 3, 2005
Messages
216
Location
Hornsby
Gender
Male
HSC
2005
I know this section is practically dead, but i thought i'd ask anyway .. looking for an answer to the 2003 Q16(c) SQL Question. Being that ive just tried to teach myself SQL thismorning I was hoping to compare my answer to that of someone elses in order to confirm its in order.

SELECT "Cost", "Peripheral", "Maker", "Model"(how would we define multiple entries?)
FROM "Hardware"
WHERE "Cost<100" .. (or is it Cost = 99 ??)
AND "Peripheral=scanner"

Thanks .. will post in the IT section of BoS later on if theres noone here :s
 

...

^___^
Joined
May 21, 2003
Messages
7,723
Location
somewhere inside E6A
Gender
Male
HSC
1998
i don't have the question with me, perhaps you would like to post the question up with relevant information;

but looking at the syntax, you might need to add ";" at the very end so the program will know where the script might end(note: i forgot if this is required for the hsc syllabus)

i don't think you need the invert commas for each of the field and table selected

however, the place you might need the invert commas will be

...
WHERE Cost < 100
AND Peripheral = "Scanner";
 
Last edited:

greatapoc

New Member
Joined
Sep 4, 2004
Messages
19
Location
Newcastle, Australia
Gender
Male
HSC
2006
My attempt would be

SELECT Cost, Peripheral, Maker, Model FROM Hardware;
WHERE Cost<100 AND Peripheral='Scanner';

Notice the positions of semi-colons as well as single quotes. Numbers should not be enclosed in quotes while words must be inside single quotes.

Hope this helps.
 

...

^___^
Joined
May 21, 2003
Messages
7,723
Location
somewhere inside E6A
Gender
Male
HSC
1998
i think " " and ' ' works the same..not too sure


and for the original question whether to use < 100 or = 99

<100 will select any integers less than 100(not including 100)
= 99 will only select the number 99, not 98, 97 , ....

so this depends on the nature of the question
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top