I have trigger and procedure. I want to be sure that string saved to database will have no ‘-‘ characters. After executing UPDATE interesant SET interesant_nip = ‘555-555-5555’ I get error …
how the sql works by in a sql about using index
how can this sql use index and how can this sql not use index. CREATE TABLE `testtable` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `a` int(11) NOT NULL, `b` int(11) NOT NULL, `c` int(11) NOT …
Duplicate column name – inner join
This is my query : SELECT FinancialMoein.*, FinancialMoein.kol_code as kol_code , TBFC.kol_code as parent_code FROM ( SELECT TP.*, ifnull(TP.kol_code,TP.moein_code)…
Rounding of hours in sql queries
The values you see below are loaded with a query and they are related to a time stamp. What they ask me to insert is a rounded value; up and down. Rounding must be done at minutes of 15 and 30. If …
How to insert today’s date in SQL select statement using python?
I’m trying to send today variable into SQL but it is not working. import datetime from date today = date.today() stmt = “select agent_email from customer_interaction_fact where to_date(DT) >= + …
Expand a postgres array of JSON within a single column into multiple records
I have a table called goals where each row contains 1 goal. The data about specific metrics for the goal is stored in ARRAY of JSON called goal_metrics. Sometimes there is 1 metric, sometimes there …
BigQuery nested table UPDATE based on condition of non-nested data AND nested data
I am trying to update records in a bigQuery database that looks like this: Using the code below: UPDATE `tottus-chile.espacio.nested_table` SET addresses = ARRAY( SELECT AS STRUCT * REPLACE(‘…
Query for two tables with similar information
I am working on some baseball stats to improve my database abilities I have data for hitters from 2017 and 2018 MLB seasons. what I hope to accomplish is to average the number of games played, at bats …
One value for multiple placeholders in nodejs-mysql
To allow users to login using thier username or email OR phonenumber, I’m using this query: res.post(‘/api/userlogin’, function(req, res){ connection.query( ‘SELECT * FROM users WHERE …
Query holiday from column with condition
I will explain with tables result. I have a table “emp” which consists of columns (number of employee”id_emp” ,”date” and ‘”type”): id_emp Date Type 5 2019-08-01 NULL 5 …