Category "sql"

Want SQL statement to return all columns

Write a SELECT statement that returns the LastName, FirstName, and AnnualSalary columns of each instructor that has a unique annual salary. In other words, don

How do i create a specific one many view using Microsoft SQL Server

I have a master table and a detail table. Question 1: I would like my view to look like this master1 row, nulls master1 row, detail1 row for master1 master1 row

How should I optimize the order by index

1.select * from transactions where from_account_id = 51118 order by block_number, index desc limit 20; Limit (cost=295.39..4973.89 rows=20 width=605) ->

Get working days (Monday-Friday) and replace them with "between" in query

I have some query in which I am substituting 2 dates in a field "between". SELECT ... FROM ... WHERE o.EventDate between @startDate and @endDate How to make it

How to prevent python from automatically escaping backslash with dubble backslash

I'm looking for a method to forward a string so for example ip 1.1.1.1 becomes ^1\.1\.1\.1$. I tried a couple of thing but all of them results in the following

Unable to make raw SQL calls from Entity Framework Core

I am working on a project where I am moving specific rows from a table between multiple different environments. The table has an Identity column and when I try

proc Sql Case Statement returning Null values

Can someone look at my Proc Sql and tell me why the below case staement is returing Null values in the data? I have never seen this, there are no errors, the co

How to do Group By and SELF JOIN in single table

Here is what I am trying to get done. Partly I am thru, Partly I am stuck, and need some help. Table structure: CREATE TABLE UserRole ( Id bigint NOT NULL A

Append Changed and New Employees to Existing Table

I have a table (Table 1) which is a list of employees and data points about them. The data that populated Table 1 is regularly changed and added to in its sourc

SQL Indexing not improving speed

Given an SQL database with index for (startpage, endpage), with a relation Articles(*ID*, title, startpage, endpage), why isn't a query SELECT title FROM Artic

Error: can not delete or update parent row

I'm trying to Delete all the records related to this supplier from all relevant tables for Supplier with supplierNum = S3. But when I try to delete, I get an er

Is there a way to build custom expression in SqlKata for the Select/Order clause

I wanted to pass custom expression to SqlKata The expected output is: SELECT DISTINCT(Column1 + ' ' + Column2) FROM Table1 ORDER BY Column1 + ' ' + Column2

Most donor to acceptor ratio

There is a blood bank which maintains two tables: DONOR that contains information on the people who are willing to donate blood and ACCEPTOR, the people who are

Eliminating NULL Values in SQL

I have a complex subquery within a query giving me this: Col 1 Col 2 value1 NULL NULL value2 value3 NULL NULL value4 value5 value5 But instead, I need this ou

http error 400 with esp8266 when trying to send a JSON objekt

Hej I wish to send a json objekt from my esp8266 to a SQL database which works when i test it with postman. The problem occurs when I try sending it from esp826

How can i submit a form with logged in user as default?

After you sign up, you are prompted to the login page, and after you login, you are redirected to another page that contains a form used for gathering additiona

Using multi character delimiter while exporting SQL table as text file using python

I am trying to export SQL table as multi-character delimited text file in python. I have tried using Pandas, but it is only supporting single character as delim

how to repeat a block of code in bigquery for multiple columns?

I would like to repeat a block of code with a complex operation (defined in a subquery) for many columns in bigquery. I cannot find a better way than copy and p

LISTAGG in Oracle to return distinct values

I am trying to use the LISTAGG function in Oracle. I would like to get only the distinct values for that column. Is there a way in which I can get only the dist

calculate a normal distribution in trigger SQL

I want to create a trigger in SQL when updating data in a column we will check what the data is and we will update in a separate column and use a normal distrib