Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SQLite query cannot inner join tables in Java, but the query works on SQLite Manager. Query results on SQLite Manager: Select t1.Table1Test1 AS T1T1, t2.Table2Test1

SQLite query cannot inner join tables in Java, but the query works on SQLite Manager.

Query results on SQLite Manager:

Select t1.Table1Test1 AS T1T1, t2.Table2Test1 AS T2T1, t3.Table3Test1 AS T3T1, t4.Table4Test1 AS T4T1 From Table1 t1 INNER JOIN Table2 t2 ON t1.Table1PK = t2.Table1PK INNER JOIN Table3 t3 ON t2.Table2PK = t3.Table2PK INNER JOIN Table4 t4 ON t3.Table3PK = t4.Table3PK WHERE T1T1 = "table1test1"

image text in transcribed

Query Results on Java, it gives an error when inner joining tables in Java (The query is the same on SQLite and Java, but different results):

image text in transcribedimage text in transcribed

When I don't inner join tables in Java, the query works:

final String sql = "Select t1.Table1Test1 AS T1T1,t1.Table1Test1 AS T2T1, t1.Table1Test1 AS T3T1,t1.Table1Test1 AS T4T1" + " FROM Table1 t1 WHERE t1.Table1Test1 = ?";

image text in transcribed

Here is a link to Google Drive for the database, Create Table, Insert Value and Query files: https://drive.google.com/open?id=1vrWDtAh8qIkVECWT030IHNXJkN0Ctq9Y

Please look at the table I created and why query with inner join works on SQLite, but doesnt work when executing it in Java.

1 Select t1.Table1Testl AS T1T1, t2.Table2Testl AS T2T1, t3.Table3Test1 AS T3T1, t4.Table4Testl AS T4T1 2 From Table1 t1 INNER JOIN Table2 t2 ON t1Table 1 PK = t2Table 1 PK INNER JOIN Table3 t3 ON t2.Table2PK-t3,Table2 PK 4 INNER JOIN Table4 t4 ON t3.Table3PK t4.Table3PK wHERE T1T1 = 'table 1 test!' T1T1 T2T1 T3T1 T4T1 1 table1test1 table2test1 table3test1 table4test1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DNA Databases

Authors: Stefan Kiesbye

1st Edition

0737758910, 978-0737758917

More Books

Students also viewed these Databases questions