Category "sql"

Adding LIMIT to ARRAY_TO_JSON or ARRAY_AGG

In a 2-player game using PostgreSQL 9.6.6 as backend I have defined the following custom stored function for retrieving chat messages for a user: CREATE OR REP

Mysql PREPARE statement is taking much times at the time of record insertion

I am using PREPARE statement in store procedure but it is taking much time at the time of records insertion. Please suggest me the replacement for PREPARE state

How to use like in MySQL query in Grafana?

I am working in grafana with MySQL. I have a template variable and it has multiple values and I want to use that template variable with MySQL query using 'like'

How to organize variable IDs that depend on each other in MySQL

I'm creating a database for all the Magic the Gathering cards... The card table looks like this: cardID name text rarityID colorID editionID other colu

How to read a csv using sql

I would like to know how to read a csv file using sql. I would like to use group by and join other csv files together. How would i go about this in python. exa

How to get distinct values from a column with all its corresponding values in another column

I have a table table_categories (id INT(11), cname VARCHAR(25),survey_id INT(11)) I want to retrieve the values for the column cname without duplication, that

INSERT INTO MySQL statement failing [closed]

I am dynamically forming MySQL statements in PHP and can't figure out why this one is failing to execute: INSERT INTO users ( `email`, `pa

How to effectively search through MySQL DB with multiple searcheable columns?

I have a table with 60 boolean (TINYINT(1)) searcheable columns. User has possibility of using any subset of the given columns as search condition. Based on tha

Oracle SQL query to list weeks between two dates

I have one requirement START_DATE : 03/01/2018 END_DATE : 31/01/2018 I need a query which will list all the weeks starting date and end date between these two

Count field, joins, multiple selects

I have three tables. Estimates, Estimate_versions, and customers. Here is some SQL SELECT estimates.id, estimates.estimate_number, estimates.description, est

Date to String format in Firebird

How can I customize CAST (TimeStamp TO STRING) format in Firebird? cast (<DateField> as VarChar(25)) It does not work as I want. I do as I wish with t

ORA-03150: end-of-file on communication channel for database link

In an Oracle database there's a big PL/SQL procedure being executed periodically that copies data from one DB to another one through a database link and it is f

Use OR operand on BOOL (tinyint(1)) Fields MYSQL

Is it possible to use the OR operand when comparing two boolean values? Using MYSQL 5+ Ex. ON DUPLICATE KEY UPDATE table1.3_InMarket = (table1.3_InMarket OR

deleting sql code with python and selecting from JOIN

I have just started with Python and am already aware of the basics of SQL. In this code I'm trying to join tables and just test out python however I have two pr

Generate sql insert script from excel worksheet

I have a large excel worksheet that I want to add to my database. Can I generate an SQL insert script from this excel worksheet?

DNN - Add or create a Role in DotNetNuke with SQL

I need to add a new DNN role in SQL. If I add a new record to the dbo.roles table, it does not seem to create the role in the Security Roles page domain.com/Adm

How to highlight SQL syntax of Room Dao in Android Studio

With new Room, How to highlight SQL Syntax in Dao Interfaces? For example @Query(SELECT * FROM user) is it possible to highlight the words SELECT, FROM with a

Deadlock involving SELECT FOR UPDATE

I have transaction with several queries. First, a select rows with FOR UPDATE lock: SELECT f.source_id FROM files AS f WHERE f.component_id = $1 AND f.a

SQL for ordering by number - 1,2,3,4 etc instead of 1,10,11,12

I’m attempting to order by a number column in my database which has values 1-999 When I use ORDER_BY registration_no ASC I get…. 1 101 102 10

postgresql sequence getting max_value

How to get max_value and min_value Postgres sequence? I created the sequence using this statement create sequence seqtest increment 1 minvalue 0 maxvalue 20;