I’m new to SQL and I am also new to NetBeans. So please forgive me if this is really simple, but I don’t understand what I’m doing wrong. I have a table called “user” which has the columns “id”, “username”, and “password”. I’m trying to retrieve a single row from my database. The only fields I need are the username and password. So I have the following:
SELECT
user.username AS "Username",
user.password AS "Password"
FROM "user"
WHERE
user.username = "billy"
I’m using netbeans to test my query. I have setup a database that contains a user with the username “billy” along with a corresponding password. When I click “Run SQL” within netbeans, it comes back with the following error:
Error code -1, SQL state 42X01: Syntax error: java.lang.String.username.
Line 1, column 1
Can anyone tell me what I’m doing wrong?
Well… after a bit of trial and error, I replaced all of the references to
user.columnwith"column". That seemed to solve my problem. For reference, here’s what the query looks like: