What is better in MYSQL count(*) or count(1)?

This is a MySQL answer. They perform exactly the same – unless you are using MyISAM, then a special case for COUNT(*) exists. I always use COUNT(*) anyway. https://dev.mysql.com/doc/refman/5.6/en/aggregate-functions.html#function_count For MyISAM tables, COUNT(*) is optimized to return very quickly if the SELECT retrieves from one table, no other columns are retrieved, and there is no …

Read more

Version vs Distrib number of MySQL

Ver refers to the version of the mysql command line client – what you are envoking by typing ‘mysql’ Distrib refers to the mysql server version your client was built with. This is not to be confused with the mysql server you are connected to, which can be obtained with SELECT VERSION(); The mysql client …

Read more

MySQL InnoDB: autoincrement non-primary key

Yes you can. You just need to make that column be an index. CREATE TABLE `test` ( `testID` int(11) NOT NULL, `string` varchar(45) DEFAULT NULL, `testInc` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`testID`), KEY `testInc` (`testInc`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; insert into test( testID, string ) values ( 1, ‘Hello’ ); insert into test( …

Read more

Error: Most middleware (like json) is no longer bundled with Express and must be installed separately. Please see

There are a number of changes with express 4.x. Like the error says, all of the middleware has been removed. Update your package.json to include the “new” packages, a basic list can be found here and a full list here Using your code from above, you would just need the following: // package.json { “dependencies”: …

Read more

Deterministic function in MySQL

From the MySQL 5.0 Reference: Assessment of the nature of a routine is based on the “honesty” of the creator: MySQL does not check that a routine declared DETERMINISTIC is free of statements that produce nondeterministic results. However, misdeclaring a routine might affect results or affect performance. Declaring a nondeterministic routine as DETERMINISTIC might lead …

Read more

What are the “Internal Relations” defined in phpMyAdmin?

This is a phpmyadmin internal mechanism to manage relationship between tables. This feature is actually useful for MYISAM tables which don’t support foreign keys and constraints. By defining internal relations in phpmyadmin you link tables together which otherwise can’t be linked. These information are stored in a phpmyadmin specific table inside your MySQL server (phpmyadmin.PMA_relation). …

Read more