I've imported a CSV file to an Oracle DB table. If I'm querying the first ten rows with a few columns it's no problem as you can see.
But if I want to the value "EDEKA-Neukauf" in column "Firma" with the where clause it returns that there's no row selected. As you can see here:
Does somebody has a solution? Because it seems like the columns were imported correct
The answer is that the where clause has to be combined with like, this will look like: where Firma like '%EDEKA-Neukauf%' . Thanks to Albin Paul.
Related
I haven't been able to find this exact question - but it seems simple enough that it's likely been asked before. I apologize in advance if my search skills aren't up to par...
Anyhow, I am trying to create a 'source_flag' column, appended to several tables I'm creating. Basically, each year and payment type has it's own table. I can query and manipulate each table individually, but I'm joining them all together (full join) at the end of the process. I want to create a column with each observation equal to the table the data came from.
For example, I want to join six tables:
2019_PD
2020_PD
2019_PB
2020_PB
2019_PN
2020_PN
All I want to do, is in the query for each table, create a column assigning the table name to the entire row, so that I know where each row came from.
proc sql;
create table 2020_PD as select
...,
...,
...,
"2020_PD" as source_flg,
.
.
.
;
quit;
Right now SAS is trying to find a field called 2020_PD - which obviously doesn't exist. Is there an easy way to do this within the proc statement? I'm not trying to add additional data steps since I'm doing this with too many tables to make that viable.
Thank you!!
SQL uses single quotes to delimit strings. So use:
'2020_PD' as source_flg,
The double quotes are interpreted as escape characters for an identifier, which is why you are getting an unknown column error.
I'm having a table with 6 columns and I want to perform a select query based on all 6 columns, but one column's data is mistyped/incorrect and I get no data returned. What could be used to still have my data returned even though some data is incorrect, but I still want most relevant records to be returned?
Don't know how much this can help you, But you can give a try using SOUNDEX function in SQL server.
Check this link for information on SOUNDEX Function
I want to query a table to get how many columns in that table and the name of each column. this post tells us how to do it in BQ command line interface, but can we do it using query?
From the following doc, it seems that the meta-tables won't give this kind of information. So, I guess the answer is no.
https://cloud.google.com/bigquery/querying-data#using_meta-tables
You can try this
SELECT
count(*)
FROM
`project`.dataset.INFORMATION_SCHEMA.COLUMN_FIELD_PATHS
where
table_name="table_name"
I am new to SQLite and trying to work my way through the basics. The problem is when I give it a simple command:
select * from newTable;
The output is as follows:
GoodState|GoodCapital
ShittyState|Raleigh
Which does not provide the column names on the output. My column names are: State and State_Capital
Is there any option available to make the column names show up on the top of the columns outputted like in MySql?
Oh. My bad. I should've googled more thoroughly.
The answer is:
.headers on
This enabled column headers in output.
I use PostgreSQL database and C to connect to it. With a help from dyntest.pgc I can access to number of columns and their (SQL3) types from a result table of a query.
Problem is that when result table is empty, I can't fetch a row to get this data. Does anyone have a solution for this?
Query can be SELECT 1,2,3 - so, I think I can't use INFORMATION SCHEMA for this because there is no base table.
I'm not familiar with ecpg, but with libpq you should be able to call PQnfields to get the number of fields and then call various PQf* routines (like PQftype, PQfname) to get detailed info. Those functions take a PGResult, which you have even if there are no rows.
Problem is that when result table is empty, I can't fetch a row to get this data. Does anyone have a solution for this?
I am not sure to really get what you want, but it seems the answer is in the question. If the table is empty, there are no rows...
The only solution here seems you must wait a non empty result table, and then get the needed informations.