I’m only a self-taught data-querying guy and am wholly unfamiliar with creating tables and such. The database I’m working on does have a calendar table, but it’s only a forward moving calendar moving …
Include all selected types, filter out duplicate where primaryType takes precedence
What I’m trying to accomplish is select from a table and return all the records where the Type matches one of the parameter types. Remove duplicates with the primaryType being the record of choice if …
SQLite: Selecting multiple counts from one column
I am running a query with SQLite and am relatively new to this. Glance of my dataset: I want group the results by Col A and then show 3 more columns (mild, moderate, high) and their counts — Here is what I’m looking for: I know how I can select just one of the columns (say, mild), but not sure
MySQL Group by with named columns from grouped data
I’m writing an application to record 10 pin bowling game results. I’ve done the submission bit but I’m stuck on displaying the results. Here is the structure: In the example above I am assuming each person played 3 games, however any number of games could be played. How can I get the data in…
Difference between x = null vs. x IS NULL
In Snowflake, what is the difference between x = NULL and x IS NULL in a condition expression? It seems empirically that x IS NULL is what I want when I want to find rows where some column is blank. I ask because x = NULL is treated as valid syntax and I am curious whether there’s a different applicatio…
Problem with foreign key in Entity Framework one to many
I am having some foreign key problems, it turns out that I am doing a revision to an old system in which a new table is added, and in doing so, the following arises. In short, I have the following 3 …
String to Datetime in BigQuery
How do I convert the int64 of format yyyymmdd into DateTime in Google Big Query? My target column is TIMESTAMP.
Have multiple parameters in a WHEN part of a SQL Update Statement
I need to write a sql update statement without repeating the parameter on the WHEN part of the query, below query works fine however I would like to group the related parameters together, this is how the current query looks like for example I would like to use an IN to group bundle all the STCs belong to 40 t…
Group by issues with multiple columns
I am having trouble making a query work. I am selecting 5 columns, using 3 to filter and 1 to count: I keep getting an error that the other columns have to be grouped by or aggregated. I’m trying to get the total students per class per professor. I’m only selecting the other columns so I can filte…
SQL Use column value in another column
What I’m trying to do is best described as mad-libs within SQL where there is one column that acts like a “template” that will end with all the values from the other columns inserted into the correct position. An example of what a sample table might look like is below. The final query should…