I’m fairly new to SQL. I’m trying to create a JTable that initially does not show any results, but will show them after I execute certain SQL queries. How do I achieve this? Is there some way I can write a query that is guaranteed to return empty?
I’ve tried
SELECT 1 FROM dual WHERE false
But that gives me a result set with one column – I want a resultset that has the same number of columns as in my underlying table, but with no rows.
For getting your columns from the table, try this:
where table_name is the name of your table from where you’re trying to fetch the columns. This query signifies that you’re trying to fetch all the columns from the table while trying to limit the rows to 0