stumped Select Rpad [message #3440] |
Thu, 26 September 2002 16:34 |
Adam
Messages: 15 Registered: October 2001
|
Junior Member |
|
|
Table: Students
field: studentnumber
field: firstname
field: lastname
Table: Classenrollment
field: classid
I am suppose to write a query that shows all the students and the classes they are enrolled in, even if they aren't enrolled in any classes at all. The output should match these requirements:
• The name column should contain both the first and last names with a blank space between them and be titled "Student Name".
• The student number column should be titled "Student Number".
• In the name column, any extra spaces beyond 15 characters on the right should be filled with spaces.
• The class id column should be title "Class ID".
• Order the query by student number.
I got this so far but am stumped
Select Rpad(firstname || ' ' || lastname, 15, '.') || studentnumber as "Name",
classid as ClassID
from students
order by classid;
|
|
|
Re: stumped Select Rpad [message #3441 is a reply to message #3440] |
Thu, 26 September 2002 16:46 |
Todd Barry
Messages: 4819 Registered: August 2001
|
Senior Member |
|
|
Aren't you missing a studentnumber column in your classenrollment table? How else would you know which classes a student was enrolled in?
Your query needs some work - I'll leave that as an exercise for you - but you will use an outer join in it.
|
|
|