Category "sql"

Postgresql pg_dump for "invalid page in block" database does not work properly

We have setup database postgresql 11 on a system. There are about 8 tables. From few days, we are facing this problem ERROR: invalid page in block 9698 of rela

SQL rank counting occurences

In my table I have data from employee contracts like this: And I want to get job position in time periods, something like this login ValidFrom ValidTo JobPosi

Azure Databricks - Generate SQL Select Statement with Columns

I have tables in Azure Databricks that I am using SQL to interact with via a notebook. I need to select all columns from a table with 200 columns, I need to sel

showing 1 data from Sqlflite flutter

So i want to make a delete button, so the user could delete those data according to the data they choose to see. Each time the data on the sqflite were added th

mysql with date function query running slow

I found something weird while executing query today and i want to know how this happens. Below is my query: select sum(price) as total from table_a where test

Display SQL query data in grid vaadin

I would like to display the result of my SQL query in a grid vaadin I can get the data from my toto table But I can't display them in a grid How to do it? publi

SQL query - How to increase the salary of employees, without exceeding a certain salary limit

I am trying to get a query that will allow me to increase the salary of people who earn less than 2000, but I don't want the salary increase for these people to

Drupal9: Saving form as node in SQL (custom module example)

i develop a custom module with forms to save data in SQL-Datebase. I want to use for that the node-structure. Normal SQL-savings for example table works but not

Use a Python f-string to build an SQL query 'IN' clause

I'm trying to use an f-string in Python to build my SQL query. The query below seems fine: code = ('123', '234') print(f"select * from tbl where code in {code}

How can I call a .sql file from R?

I have a rather large query that I am trying to run within my R script. Rather than create a variable within my script ( that raises the error: variable names

SQL: How to generate a unique value for a Primary Key

as the title states. I do have the following table: CREATE TABLE exampleTable( ID int NOT NULL, Text varchar(255), PRIMARY KEY (ID) ); By inserti

MS Access version of a Python melt

Assuming a table organized thus: Row | School | LocationCode2011 | LocationCode2012 | LocationCode2013 001 ABC 1000A 1000B

Insert of records into SQL Server is slow whereas select is quicker

I am trying to improve the performance of insert in SQL Server. INSERT INTO [dbo].[GroupCustomerAccountProductRebates]([GroupId],[GroupName],[ProductId],[Manufa

SQL Error [1064] [42000]: You have an error in your SQL syntax while running query

While I am trying to select a table on a MySQL data base, I am getting the following error: SQL Error [1064] [42000]: You have an error in your SQL syntax; chec

Multiple INSERT INTO statements not working in dbeaver

I am trying to insert data into a table and I have written multiple Insert Into statements but I am facing an issue which is quite strange. When I run whole scr

Iterate through a list of servers in SQL Server

I have a script similar to below and get: Could not find server '@CURSERVER' in sys.servers. Verify that the correct server name was specified. If necessary, e

SQL: STATUS column is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause [duplicate]

Hi Just want to GROUP BY my table without using the status column. but I keep getting the error and I can't figure out to resolve it. SELECT *

Update column "total price" in orders table using other columns (pizza_price*pizza_amount) in different tables?

This is relational diagram of database I created: I need to insert total price in Orders.Total_Price column by multiplying the Pizza.Pizza_Price value with Ord

How do I return single orderid having same rank?

I have the following output: Orderid Time State Order_rank 1 10.15 mfr 1 1 10.15 delivered 1 2 12.10 picked 1 2 12.10 mfr 1 Here I have ranked the order ids w

how to pass asc desc as params in python psycopg2 raw sql execution?

i have a sample query template to accept dynamic parameters to execute: ps_conn = psycopg2.connect(...) ps_cursor = ps_conn.cursor() ps_cursor.execute(''' S