I have data that looks like this: I’d like to extract “subquestions” into separate rows (in an sql table): — Making ads for Meta platforms — Producing video content — Applying mobile creatives best… I have a tried a few functions json_extract_scalar, and Map functions etc, but I didn’t succeed. Thanks in advance for your help. So the thing I
Tag: dictionary
How can I avoid “stringly typed” code in T-SQL?
Consider some code like I believe that the technical term for such poor code is “stringly typed”. The key issue in the above code is that decisions are being made based on a string output that the developer needs to type and consistently get correct. If anything goes wrong, the language will be incapable of throwing errors. In a traditional
Query did not return a unique result
This is the query I have written: This is the output I am getting from the database: id versions 101 0.0 101 1.0 101 2.0 101 3.0 In my application, I am storing this result in but it gives an error saying “query did not return a unique result” How can I store this result? which data structure could I
Python add items into dictionary from database table (sqlite3)
I have created a database table called fruits with 3 columns, id(int primary key), fruits(text) and weight(float). id fruit weight 1 Apple 80.5 2 Pear 150.8 3 Kiwi 69 How do I create a dictionary and add all the fruits and weight as key-value pairs to the dictionary? Answer Something like this: fetchall() returns a list of tuples of values
Filter dictionary in pyspark with key names
Given a dictionary like column in a dataset, I want to grab the value from a key given that the value from another key is satisfied. Example: Say I have a column ‘statistics’ in a dataset, where each data row looks as: I want to get the value of ‘eye’ whenever hair is ‘black’ I tried: but it gives an
How do I create a dict of values from the results of an SQL query?
I’m trying to create a journey booking system in python/flask and am trying to create a dict of starting destinations and their ending destinations to allow me to run some ajax code which restricts the options of selecting destination based on the starting location like this (this is just an example of what I’m trying to create, not exactly the
How to transform data into a map using group by in Hive SQL?
I have data like below …and I want to create a map with lecture as the key and count as a value. How can I get an output like below? Answer If you can live with count being a string, you probably be able to use Hive str_to_map() function to get a desired map. That will require a couple of
How to populate dictionary using SQL table data
In my C# project, I have a dictionary, its values are currently static. Now I need to set to its values in dynamically. how can I do that? I have an Oracle DB table called “country” there have two columns called, ID and CountryName as follows, How can I set this table values to my dictionary? Thanks in advance. Answer
Using SqlQuery<Dictionary> in Entity Framework 6
I’m trying to execute a SQL query in EF 6. The select query returns two string columns, e.g. select ‘a’, ‘b’, and can have any number of rows. I’d like to map the result to a dictionary, but I can’t …