dan dan - 1 year ago 24
SQL Question

Select specific rows and columns from an SQL database

Is it possible to retrieve specific columns of specific rows in an

SQL query

Let's say I'm selecting from my
table, called
, rows whose names are: a, b, using this query text:

"select * from my_table where row_names in ('a', 'b') order by row_names"

How can I modify this query text to select only columns 2,12,22,32,42 rather all its 1000 columns?


Replace the wildcard symbol * with the column names you want to retrieve.

But please read up the documentation on SQL standard. It is very unlikely you need 1.000 columns in a table.