Category "sql"

Date scaffolding with multiple different date measures?

I want to show the amount of people in each contract status historically. I have a list of every contract's start date, suspension dates, expiration date, and t

Need help understanding why this query is producing these results

Consider the database entries below. The distinguishing identifier is the "short" item number, 89721. Data: F3003 IRKIT IRKITL IRMMCU IRMCU IREFFF

Android Studio: ContentValues vs Database.execSQL()

My question can be considered as a continuation of What is the difference between inserting data using ContentValues and Raw SQL in SQLite Android? My question

what is blanket update in SQL query?

I have a few update queries, and I need them as a blanket update. update Table_A set status=0 where task_type='AAA' and task_name='BBB'; update Table_A set st

Improving SQL Query to check condition

Currently, the sql code that I have is to check for the three fee_code records do any of them have election_code = NA. I'm trying to figure out how to change th

How to count elements based on a unique value in BigQuery

I have this table 1 in Bigquery and I need to count the elements in column segments and category that correspond to a single user id. Desired outcome presented

Group by Day of Month

Say I have a table logins with just the bigint id ,a date_login of type datetime, and fk_user of type bigint. I need to select the first and last logins for eac

Athena count/Sum column divided by count/Sum column returns zero

I am trying to find percentage based on id column. issue - I am trying to use count(column)/select count(column) from table which is giving output as 'Zero' Tab

Counts for time range per day

I have a table something like this create table widgets ( id primary key, created_at timestamp, -- other fields ) Now I want a query that shows the co

Apex Report to load last 30 min of data

I am trying to have an APEX report show only responses submitted in the last 30 minutes. Is it possible to do this with the where clause? Getting stuck with all

I was trying to implement per tenant one database using ABP framework but couldn't succeed with that approach

I was trying to implement per tenant one database using ABP framework but couldn't succeed with that approach. In the documentation, it says to configure using

BigQuery Search which results in Error: Scalar subquery produced more than one element

Running this query on BigQuery but resulting in this error: Error: Scalar subquery produced more than one element select * from CRM.organizations where name L

Creating tables in SQL with the corresponding attributes, from an ER model

If I have an ERD: https://i.stack..com/gj3Sn.png Which I'm trying to type up in postgres SQL. How could this be done? So far i've got:

SQL insert into table with values selected from other tables where an external value matches

I have the following tables: Table1: id rarity 1 Common 2 Uncommon 3 Rare Table2: id Type 1 Air 2 Earth 3 Fire 4 Water The output table already exists and t

Django SQL Server studio backend doesn't support altering from/to AutoField

Please help me I tried to connect to the database The connection was successful and the rules were lifted, but I have this problem raise NotImplementedError("t

Pythonic way to write OR SQL condition to extract information schema data from Snowflake

I am connecting to Snowflake using python (Below code). As you can see I am trying to get Row Count,Date table was created and altered from Information Schema t

Is there a way to get the EntityManagerFactory on a project that uses Java Spring JPA but doesn't have a "persistence.xml" file?

I want to use the EMF to do queries constructed at runtime on a String. If there is a way I would appreciate it if someone could tell me how and give a small ex

EF6 Entity framework sometimes slow query on SQL Server

We have started a new project in .NET Core. We are just starting out and we are hitting a Web API endpoint to get some reference data of 8 records. We noticed

Percentile rank over multiple partitions averages

Assume I have a table like this id cnt tier 1 100 gold 2 200 silver 3 300 bronze 4 400 bronze 5 500 bronze 6 600 gold 7 700 silver 8 800 silver 9 900 silver 10

Sql: hackerrank aggregation

Samantha was tasked with calculating the average monthly salaries for all employees in the EMPLOYEES table, but did not realize her keyboard's key was broken un