I have some monthly data as below: Month | Category | Monthly Value 2020-07-01| Food | 1 2020-07-01| Entertainment | 4 2020-08-01| Entertainment | 2 2020-09-01| …
Is it right situation to do left outer join?
I have two datatset, A and B.(A is a big dataset like personal info and B is like a small summarized demographic statistic data) I want to append summary info to A data with demographic info. As one …
Group elements of a column into mulitple subgroups SQL
I am looking at different breeds of cattle and their AnimalTypeCode , BreedCateoryID and resultant Growth. I have the following query SELECT DATEPART(yyyy,[KillDate]) ,[AnimalTypeCode] …
PostgreSQL left join query with one to many relationship
I have below tables CREATE TABLE employee(id serial PRIMARY KEY,employee jsonb); CREATE TABLE perks_details(id serial PRIMARY KEY,details jsonb); insert into employee(employee) values (‘{“name&…
Why is my mySQL throwing “ERROR 1215 (HY000): Cannot add foreign key constraint”
Error Recieved: ERROR 1215 (HY000): Cannot add foreign key constraint Code: CREATE TABLE servers ( serverID varchar(20) NOT NULL, serverPrefix varchar(1) NOT NULL, captchaEnabled boolean …
Oracle query – How to check if a user is the only one assigned to a project
I am trying to determine if a user is assigned to any project with a specific role (ProjMemberTypeID) and if so, if s/he is the only one. There is “projMember” table with Project ID, User ID …
I cant do a select by one of its parameters even if it exists in the database. Encoding issues? PostgreSQL
I have a postgresql database snapshot with the following structure But it has some weird issues, for example I have this data Some example of data is: Well the problem is now that I do this select 0 returns But if i do It does return the result What is going on? It works with some addresses, but doesn’t…
SSIS Conditional Split Reject files [closed]
I want to migrate the data to a target table. However, I want to make a reject file for null values and values whose size exceeds 20 characters. As I do with Conditional Splitting? I did that but …
SQL syntax with FOREIGN KEY
I have the following tables: CREATE TABLE IF NOT EXISTS {}.roles_permissions ( role_id INT (12) NOT NULL, permission_id INT (12) NOT NULL, UNIQUE KEY (role_id,permission_id) CONSTRAINT `fk-rprole` …
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