Excuse my ignorance about this… I’m taking a data analysis course and I stumbled upon this query in an exercise: ActivityDate is a field that contains date type data and DATE_REGEX is a regular expression variable for a date format string. What I don’t know, is what does taking the MIN() of this boolean expression REGEX_CONTAINS do or mean. I
Tag: sql
Trying to publish SQL DB on Visual Studio, I keep getting SQL72025 error
I’m trying to publish a database using Visual Studio, the project has no issues plus I downloaded the (Data storage and processing) toolset. Yet I keep getting SQL:72025 error every time I try to deploy the project. SQL:72025: The referenced assembly .DLL is corrupt or invalid. I get the same message if I try to build the project too. Now
Can a backticked identifier have a backtick in it?
Is it possible to escape a SQL identifier in either MySQL or BigQuery or any other RDBMS that allows quoting of identifiers with the ` character? For example: Works, but then How would I add a literal backtick to it, or is that just not allowed? Answer Yes. Use a doubled backtick, eg: This is similar syntax for including quotes
Adding a set to a database table, using format string – how to include null values
I have a set that depending on the situation can contain anywhere between 1 and 5 elements. I am saving this set to a database table using a format string. My table contains 5 tables, but when creating it, I did include that it was okay to have null values in the columns. my set below can be: but it
SQL – make a column unique after some timestamp?
Here is my use case. I am using Postgres 13.3 I have a people table under a draft schema that has multiple columns.. email and created_at. The email should have been unique but it was not. If I alter the table to be unique, there were duplicate emails inserted before and I don’t want to lose the data by removing
Only count SQL entry if two rows (as a pair) have the needed conditions
How can I only count the “Great” per “Country” in this SQL table? My table “commentmeta” comment_id meta_key meta_value 540 Voting Great 540 Country UK 560 Voting Great 560 Country PL 610 Voting Bad 610 Country UK 630 Voting Great 630 Country UK The result should be UK: 2 times “Great”, PL: 1 time “Great” With something like this I
How do I extract the string after 0: in big query sql
I want to extract extract “f9sdsdsd-1375-41f7-8c4c-ereb20ad3843c” from “0:f9696a03-1375-41f7-8c4c-34b20ad3843c”. I am currently using TRIM(REGEXP_EXTRACT(“0:f9696a03-1375-41f7-8c4c-34b20ad3843c”, r”0:[^:]+)”)) . However, I am not getting being able to extract it with the current syntax. Can someone please help me here? Thanks. Answer you are just simply missing ( – use below
Presto – How to convert a field with map to rows
I’m new to Presto SQL and I am stuck to a issue and I really need your help. I have a table with a field “Info”: I want to pull all order_id(s) and convert them as rows, the output may look like this: My query: I tried the query above but it can only returns the order_id as an array.
How to union two counts queries in SQLAlchemy?
I have two queries and the only difference between then is that one is counting the success status and the other failure status. Is there a way to get this result in just one query? I’m using SQLALchemy to do the queries. Answer You can use conditions on Count, your query will look like:
Randomly Assign Rows in Child Table to Row in Parent Table
Using MySQL, I am trying to randomly assign rows in a child table to point to a row in a parent table, per following: Parent table: There are 50 WorkGroups (Team Alpha, Team Bravo, etc.), each of which can have a maximum number of WorkEmployees. Child table: There are 2,000 WorkEmployees (Ann, Bob, Carl, etc.) each of whom needs to