BigQuery - Reference Nested Data In Single Column? - sql

I'm new to SQL, so I'm not even sure I'm asking the question correctly.
I connected my Google Analytics 4 to BQ to save all the data. When I open up the preview, I'm seeing multiple rows nested in a single column.
See image
Since I'm new, I'm not even sure I'm using the right language to describe this, so any corrections are welcome.
If I wanted to add a WHERE to only bring up certain page_location, how would I do that? The typical 'WHERE page_location = https://blahblahblah' doesn't work.

Related

Sybase Database, Data is nowhere to be found?

Here's my situation. We have an application that uses sybase to store it's data on the back-end.
Please refer to my screenshots below for better understanding of what I'm talking about.
In our application, we have some custom "tabs" (columns in the db) which are supposed to contain data on the db tables. When opening and viewing in the application, these tabs contain data (so they must reside somewhere...), however when you query the table they're supposedly residing under, there's no data to be found. These columns should not contain all null values!
In this example, "trainer" is one of the columns which should contain data. I do a [sp_columns #column_name = 'trainer'] and see that it supposedly resides under table "user_tab_data" (screenshot 1).
Expanding user_tab_data in our sql browser, we see the data points we need to query (training date, training course, trainer, etc.), however when querying for the values, nothing comes up! We can see when opening the application that there is indeed data stored somewhere though.
Is there anything I can do to locate this? Am I missing something here? Any help is appreciated.
Thank you
sp_columns to find table name
query showing that table contains null values
Well this is embarrassing. I figured it out. There was just so many entries on the table that you could scroll for hours and not see any entries where the columns I wanted had any data.
I had to do 'is not NULL' to pull only the ones I wanted to see.
Duh.

How to have Google BigQuery properly detect header names?

I successfully created a new table using the data I uploaded onto Google Cloud Platform's Storage, but the problem is the header field names are always wrong when I use the Automatically Detect setting, and set "Header rows to skip" to be 1...I just got generic names such as "string_field_0".
I know I can manually add field names under Schema, however, that is not feasible with tables that have many fields. Is there a way to fix the header names? It doesn't seem to be a big thing though...Pandas does this automatically all the time.
Thanks!
csv file in Excel:
The problem is that you only have String types in your file. So, BigQuery can't differentiate between the header and actual valid rows. If you had say another column with something other than a String e.g. Integer, then it will detect the column names. For example:
column1,column2,column3
foo,bar,1
cat,dog,2
fizz,buzz,3
Correctly loads as this because there is something other than just Strings in the data:
So, either you need to have something other than just Strings, or you need to explicitly specify the schema yourself.
Hint: you don't have the use the UI and click a load of buttons for define the schema. You can programatically do it using the API or the gcloud CLI tool.
Since it was not mentioned here, what helped me was to add 1 to Header rows to skip. You can find it under Advanced Options:
My database came from Google Sheet and it already had integer values in some columns.
Same issue occurs with Google Sheets as well. Right, the cause is having all string data in the sheet. But the workaround is simple with Google Sheets; just adding an integer column as described here

Filter certain SQL data formatted in one column into a new column

Before I begin I found this to be most relevant with the research I have done.
How to split the data from one column into separate columns using the contents of another column in SQL
Attached are pictures of my progress so far. How can I display this information such as it is shown in the excel file without disrupting the GROUP BY filter in my Query?
It's a Fishbowl Database, newest version. I am running the queries through Flamerobin which you see in the picture. Trying to organize the query to display correctly so I can format it into 'iReports' and export it into an excel spreadsheet like the one shown. Maybe there is some part of this that would better be done in excel?
Notice the numbers for Qty are different, that's ok right now.
My reputation is too low to post pictures I am sorry. Here are the two JPGs in my Dropbox. I really appreciate the help.
https://www.dropbox.com/sh/r2rw5r2awsyvzs9/AAAXXg27CMPOYtZFqPX3Dx6la?dl=0

Using DataSets in vb.net

When looping through a DataSet why do you have to user the "(0)"??? Every time I dont use it I get an error, so I have learned use it but not really sure why? Im just trying to get a better understanding of why this is used. Here is an example below:
for each row as datarow in ds.tables(0).rows
next
'******Note: If i use this I get an error ********************
for each row as datarow in ds.tables.rows
next
And also another question comes to mind, with regards to this question is that locally through visual studio 2010 i use that for each statement and it works as expected, but if I use that for each on a production server, if there are no records i get an error, so what I have to do is do a record count, then if ok then go ahead with the for each. Is there anyway around that?
Because your ds.tables is an array of tables, and 0 is the first index of the tables array. It doesn't work in the second scenerio because you aren't defining an index, which is required to access a specific element within your array.
The issue with question one is that the dataset can hold many tables, so you need to either supply an index or table name to access the rows in that table. I am not sure why there is a difference between locally and production, it should act the same.
Wade

Hit Highlighting Blob Data

Hi ive currently been trying to do some full text searching on some .docx files stored as BLOB data in my database. Ive been trying to bring back a snippet of these documents in a google like fashion. Ive currently been following the example in the Apress Pro Full Text Searching book. However the example doesnt use BLOB data, does anyone know if what im trying to do is possible with this method ? thanks.
Should be possible. Internally SQL server stores the list of occurrence values that correspond to relative offsets of the particular keyword within the document. Please refer to the Occ column in the index structure in this article about full text search internals in MS SQL Server
I am not sure whether you have to implement your own CONTAINS or you can configure SQL server to return the occurrence values to your query. Should you figure it out, please follow this thread up.
Once you have the occurrence values returned in your result set, it is up to your application to get a snippet from the blob.