Tag Info

Hot answers tagged

9

You said I heard that we can retrieve the data by creating a new table same as the old table with storage engine as innodb or myisam Whoever told you that should have told you to enable binary logs as @jynus commented. The BLACKHOLE Storage Engine does not store data at all. It is a special storage engine used in very meticulous setups. EXAMPLE #1 : ...


3

Use UPDATE image_count = VALUES(image_count). VALUES() expects a name from the columns you are inserting into, not the alias in the query. The query should be: INSERT INTO countingTable (image_count, article_id) SELECT COUNT(article_id) AS sum, article_id FROM imageTable GROUP BY article_id -- I suppose you skipped that line? ON ...


3

Maybe the problem is that the Workbench is running your statements one at a time without you being noticed, while JDBC exactly sends to the database what you exactly ask it to send. See this answer, where a parameter is used on the connection driver to allow many SQL statements over a single JDBC statement object.


2

Are you working with datetimes? Notice that If I ran it now I'd get for instance: August, 28 2014 13:57:36+0000 Which means that if my dates are at midnight I'd get the same with < and <= You should probably cast this into DATE if you are to work with dates


2

1) means that if the parent is deleted, the child is also deleted (not a good idea IMHO - you should keep track of all data that's ever been in a database), although this can be done using triggers. You could also SET NULL. 2) means that if the parent primary key is changed, the child value will also change to reflect that - again IMHO, not a great idea. If ...


2

Autoincrement values can only be numeric (integer and floats types if I remember correctly). If you want to store S1, ...., S1000, just store an integer, and return the extra S on select or on client side: create table tbl(ID bigint not null primary key auto_increment,name varchar(100)) auto_increment=1; insert into tbl (name) values ('a'); ... select ...


2

mysqlbinlog utility is in mysql server package. You should try install mysql server.


1

MyISAM [and] InnoDB data and log files are binary-compatible on all platforms having the same floating-point number format. Source. You can copy freely between those two platforms if you maintain the same vendor and version. Obviously, the binary executables for 64 bits will not work on 32-bit.


1

To get the basic data you need an aggregation: select 1 + floor(datediff(date, mind) / 7) as week, year(date) as year, count(*) as num from atable t cross join (select min(date) as mind from atable ) td group by 1 + floor(datediff(date, mind) / 7), year(date) You can extend this using variables to get the cumulative ...


1

What you want is called the cumulative sum, you can do something like: create table transactions (transactionid int, d date); insert into transactions (transactionid, d) values (1, '2014-08-04'),(2,'2014-08-05'), (3, '2014-08-18') , (4, '2014-08-18'), (5,'2014-08-20'); select x.y, x.w, count(1) from ( select distinct year(d) as y, ...


1

These two are actions to be performed, respectively, when the referenced record on the parent table changes its id and when it gets deleted. If you execute: UPDATE parent SET id = -1 WHERE id = 1; And there is at least one record on child with parent_id = 1, 1) will fail; in cases 2) and 3), all records with parent_id = 1 are updated to parent_id = -1. ...


1

I found the problem. The slave was trying to connect to port 7 instead of port 3306 for some reason. I had to manually specify that as part of CHANGE MASTER TO command and add MASTER_PORT=3306 and it works perfectly now.


1

Maybe you can group it by the most recent Monday of the Date SELECT COUNT(1) Transactions,WEEK(monday) Week,YEAR(monday) Year ( SELECT (Date - INTERVAL WEEKDAY(Date) DAY) monday FROM mytable WHERE Date >= MAKEDATE(YEAR(NOW()),1) ) A GROUP BY YEAR(monday),WEEK(monday); NOTE: The WHERE clause in the subquery collects everything from the first of ...


1

Update 14:02 You installed mysql-server-core-5.6 which partially failed or partially installed. The -explicit_defaults_for_timestamp is only for MySQL 5.6. Its probable that the partial installation of mysql-server-core-5.6 added this option. I am going to suggest now that you remove any trace of the mysql-server-core-5.6 and reinitalize the data ...



Only top voted, non community-wiki answers of a minimum length are eligible