How do I return True if a table has any duplicate records and False if it has none. I don’t need a count, I don’t need to know which rows, all I want to know is if this table has duplicates or …
MySQL – surrounding precomputed variable with single-quotes prior to inserting
The primary key of my table is a char of fixed length 11. I have precomputed the key in my script, just like this: SET pes = LPAD(person_number, 11, ‘0’); Now, my variable meets my critera. It only …
MS SQL Server Update or Clear based on matching values
I need some help in a scenario that I am working on. I have two tables Product_Staging and Product. The contents of the table are below. Product_Staging: Account_No Product_No …
Select consecutive rows under a certain value in MySQL
Selecting consecutive rows with a column under a certain value I have a table with the following data: crashID crash ———————– 1 189 2 144 3 8939 …
Dynamically selection of Column Name
I want to select Column Name which has non null and non zero value. So any column name which has 0 or NULL should not be displayed in the output grid I have the Source table as below I want to group by Col1 and Display Col1, MIN(Col2), MIN(Col3), MIN(Col4) and ColRes as (Name of the column with value more
How to use a table variable within EXECUTE command?
I have this code: DECLARE @mytable TABLE (x INT); EXECUTE (‘SELECT * FROM ‘ + @mytable); When I run the code, I get this error: Must declare the scalar variable “@mytable “. I know that @mytable …
SQL: How to group by with two tables?
I have the tables products and history and I need to group by name: products = (id_product, name) history = (id_history, id_product, amount) I tried this SQL query but it isn’t grouped by name: …
How to link Gatsby.js with my Express server
I am trying to make a very basic full-stack application where the front-end is Gatsby and the Backend is a simple Express server. I have a Database where I have some users and the goal is get these users in the backend with a query and then displaying them in the Gatsby (React) component using fetch(). Obviou…
Find the most popular month for customers to order a certain product
I am trying to find out which month has the most orders for a certain product (Product HHYDP). This is my code so far, but each time I try to use GROUP BY and SORT BY functions related to my problem, …
Differences between OLAP and OLTP databases
What are the key differences between OLAP and OLTP databases. Specifically in terms of implementation (rather than use cases). OLAP is of course primarily used for reporting while OLTP is used for …