Let say you have the following data in you database table t1 and you want to select the IDs for the row record that have the same value on COL1 and COL2. ID COL1 COL2 COL3 ====================== 1 100 200 300 2 200 300 400 3 100 200 500 4 300 300 300 5 200 300 400 And the expected result is ID = 1,2,3,5. The SQL to a … [Read more...]
Java: How To Use SQL LIKE Clasue with PreparedStatement?
One may find that using SQL's LIKE clause in Java PreparedStatement is not straight forward. There is no documentation on how the LIKE clause should be used when it is used with the PreparedStatement object. Thus, most of the programmer would rather use the full SQL to execute the statement. … [Read more...]
Database: CHAR and VARCHAR – What are the differences?
Most programmers may already know the main different between CHAR and VARCHAR - The first one supports fixed-length data and the second one supports variable-lengths of data. Some people may think, since VARCHAR can do what CHAR does, then why we still need CHAR in our database design. I even have heard one of the very experienced Oracle database administrator say "Nowadays … [Read more...]