Is it possible to retrieve specific columns of specific rows in an SQL query
?
Let's say I'm selecting from my SQL
table, called my_table
, 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?
Selection symbols to narrow row selection To select rows using selection symbols for character or graphic data, use the LIKE keyword in a WHERE clause, and the underscore and percent sign as selection symbols.
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.
Try and read the sql, as it really does what it says
select [column name 1, column name 2]
from [table name]
where [column name 3] in ('column value 1', 'column value 2')
order by [column name 3]
please select the values of "column name 1" and "column name 2" from rows in the table called "table name" where those rows have values equal to 'column value 1' and 'column value 2' in the column called "column name 3"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With