Selecting COUNT(*) with DISTINCT

Count all the DISTINCT program names by program type and push number DISTINCT COUNT(*) will return a row for each unique count. What you want is COUNT(DISTINCT <expression>): evaluates expression for each row in a group and returns the number of unique, non-null values.

What is the difference between UNION and UNION ALL?

UNION removes duplicate records (where all columns in the results are the same), UNION ALL does not. There is a performance hit when using UNION instead of UNION ALL, since the database server must do additional work to remove the duplicate rows, but usually you do not want the duplicates (especially when developing reports). UNION Example: Result: UNION ALL example: Result:

What is an MDF file? [closed]

SQL Server databases use two files – an MDF file, known as the primary database file, which contains the schema and data, and a LDF file, which contains the logs. See wikipedia. A database may also use secondary database file, which normally uses a .ndf extension. As John S. indicates, these file extensions are purely convention … Read more

MySQL Error: : ‘Access denied for user ‘root’@’localhost’

Open & Edit /etc/my.cnf or /etc/mysql/my.cnf, depending on your distro. Add skip-grant-tables under [mysqld] Restart Mysql You should be able to login to mysql now using the below command mysql -u root -p Run mysql> flush privileges; Set new password by ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘NewPassword’; Go back to /etc/my.cnf and remove/comment skip-grant-tables Restart Mysql Now you will be able to login with the new … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)