JSP and Database Queries
Hi Guys,
Desperately searching for some useful info,
I have a JSP that is querying my db (oracle 10g).
it is working using a statement and executeQuery(), however at current i have just one table in the query, is it possible to add another
Table 1 = s_details
jobId NUMBER (10) NOT NULL,PK
sFirstName VARCHAR2 (50) NOT NULL,
sSurname VARCHAR2 (50) NOT NULL,
emailAddress VARCHAR2 (100),
institution VARCHAR2 (50),
degree VARCHAR2 (50)
and Table 2 = course_info
course_key NUMBER (10) NOT NULL, PK
courseId VARCHAR2 (8) NOT NULL,
courseName VARCHAR2 (50),
courseDesc VARCHAR2 (100),
grade VARCHAR2 (20) NOT NULL,
jobId NUMBER (10) NOT NULL, FK
i want to see all of the details so like:
jobId 1 (details) and all of hte corresponding details including the course_info.
THANK YOU in advance.
Cheers Kaite
[936 byte] By [
Lynnya] at [2007-11-26 22:50:24]

# 1
> I have a JSP that is querying my db (oracle 10g).
When you get a chance take a look at MVC - you shouldn't be writing Database Query Code in JSPs write it in Java Classes , then make use of Servlets, jsp:useBean and JSTL to access the data from the JavaClasses
> it is working using a statement and executeQuery(),
> however at current i have just one table in the
> query, is it possible to add another
You can add any number of tables to your database - there is no limit.
Only limited by how much hard - disk space you have.
>
> i want to see all of the details so like:
> jobId 1 (details) and all of hte corresponding
> details including the course_info.
Do you mean joining the results of 2 tables? Yes it is possible, it's the basics of SQL
SELECT a.column alias1 ,
b.column alias2
FROMtable a,
table b
WHERE a.primary_key = b.primary_key;