I use MySQL 5.6 and I have 3 tables. Two of them are a list of data, and the third table is used for a relationship between them. In the third table I would like to identify a default record for each id1, so I added a column named predt to let me know which record is the default one.
Using regex in sql to define new variable
I need to derive the “new” column from the “old” column using sql and regex if possible. I’m using Oracle SQL Developer. If I were using regex in R or Python, I would use this recipe to get the “new” column: Thanks. Use this: Answer Here’s one option:
Django sql statements with non english symbols
I have sql statement, with non english symbols in where (sap_code variable contains russian text) sap_code = ‘ОВОЩИ – ФРУКТЫ’ sql_string = ‘SELECT ‘ ‘SAP_CODE, ‘ ‘SKU, ‘ …
SQL – How to avoid inserting duplicate rows from another table while matching multiple columns
Using Microsoft SSMS. There are two tables Table1 ID | SessionId | Handle | StartDate | ——————————— 1 | abcd | handle1 | 2020-08-01 00:00:00| 2 | abcd | …
SQL: Returning a list of unique values with respect to another value
I have a table that tells me the products as well as which state they’re sold in. PRODUCT | STATE ————————————————- yPhone | Alabama yPad | Massachusetts …
sql clauses using HAVING truncated value error for part of the string
I am getting an integer value error but don’t understand why. Warning: #1292 Truncated incorrect INTEGER value: ‘%accepted%’; Warning: #1292 Truncated incorrect INTEGER value: ‘%pending%’ . It does not have the error for processing. It doesnt matter what is in “1st position…
COUNT(*) function is returning multiple values
I am writing a specific sql query that needs to return the position of a particular entry, based on a grouped table. Background info: I am coding a Golf Club Data Management system using Java and MS …
Displaying same data once in MySQL
So I have a table named files with the following values File Name | End User Name file1 | CNS file2 | CNS file3 | CNS file4 …
Calculate the return rate per customer based on the last three orders
DB-Fiddle CREATE TABLE sales ( id int auto_increment primary key, customerID VARCHAR(255), order_date DATE, sales_volume INT, returned_volume INT ); INSERT INTO sales (customerID, …
Oracle SQL Transforming sql rows into columns grouping by another column
I am facing trouble designing SQL for the below scenario. My table structure looks like this TABLE IMSK id | key | value | group_id 1 | k1 | a1 | g1 2 | k2 | a2 | g1 3 | k3 | a3 | g1 4 …