select subset of column in IBM DB2

317 views Asked by At

I am not being able to perform select query on a subset of columns of a database in IBM DB2.

select * from user 

This works. But

select username from user

doesn't work. Here's the screenshot.enter image description here

1

There are 1 answers

2
Mureinik On BEST ANSWER

username is a reserved word. The "proper" solution would probably be to have a column name that isn't a reserved word, such as user_name. If changing the column name isn't an option, you could use double-quotes (") to escape it:

SELECT "username" FROM user