Skip to content
Advertisement

Tag: mysql

Why use GTIDs in MySQL replication?

When it comes to database replication, what is the use of global transaction identifiers? Why do we need it to prevent concurrency across the servers? How is that prevention achieved exactly? I tried to read the documentation at http://dev.mysql.com/doc/refman/5.7/en/replication-gtids.html but still could not understand it clearly. This may sound very basic but I would really appreciate it if someone could

SELECT *, SUM(NET) AS TOTAL FROM TABLE1 WHERE CLAUSE

I was hoping to add an IF statement before WHILE. Which will still display records even there is no match dv_id on both table2. It should still display records.. The COLUMN ROLLS IF No match it will display a 0.00 value. LINK>> http://i599.photobucket.com/albums/tt79/emcevo/viewphpdisplay_zpsfc6a8174.jpg How can I display the TOTAL NET below code: I top codes are all working.. The bold

INSERT or UPDATE from another table in mysql

I have two tables, with same schema – create table test1 ( a INT NOT NULL , b INT NOT NULL , c INT, PRIMARY KEY (a,b) ); create table test2 ( a INT NOT NULL , b INT NOT NULL , c INT, PRIMARY KEY (a,…

MYSQL show all rows where no duplicates found

If I had a set of data like this: What would be the SQL query to display only “James Peters”. So I am not wanting to remove duplicates (DISTINCT command) but rather show all rows where there are no duplicates found. Answer You would use group by for this with a having clause:

MySQL SubString Returns Integer

I’ve got a table with a varchar(128) field called identifier. It is supposed to get a 3 letter identifier followed by an indexing number: At some point in the past, there was a bug and about 5,000 records were input as: Our numbers do not go that high, so these values are padded with zeros (0). I wrote out a

Using TIMESTAMPDIFF with JPA criteria query and hibernate as the provider

I have a data table with columns setup and release, both of which hold timestamps. My goal is to create an equivalent of the SQL query below using CriteriaQuery. SQL Query:SELECT TIMESTAMPDIFF(SECOND, setup, released)) as sum_duration FROM calls The CriteriaBuilder#diff() function clearly does not work as it requires parameters that are Numbers, so I tried using CriteriaBuilder#function: However, when I

Mysql issue with WHERE in clause

What is wrong with my “where in” clause in mysql? My two tables SEATS and REGISTERS look like this The query to fetch the matching results is Can someone figure out what’s wrong ? Thanks, Answer IN requires the list to be a literal list, not a comma-delimited string. Use FIND_IN_SET for that:

Advertisement