Using group by on multiple columns

Group By X means put all those with the same value for X in the one group. Group By X, Y means put all those with the same values for both X and Y in the one group. To illustrate using an example, let’s say we have the following table, to do with who is attending what subject at … Read more

What is “Advanced” SQL?

Basics SELECTing columns from a table Aggregates Part 1: COUNT, SUM, MAX/MIN Aggregates Part 2: DISTINCT, GROUP BY, HAVING Intermediate JOINs, ANSI-89 and ANSI-92 syntax UNION vs UNION ALL NULL handling: COALESCE & Native NULL handling Subqueries: IN, EXISTS, and inline views Subqueries: Correlated WITH syntax: Subquery Factoring/CTE Views Advanced Topics Functions, Stored Procedures, Packages Pivoting data: CASE & PIVOT syntax Hierarchical Queries Cursors: Implicit and Explicit Triggers Dynamic … Read more

Must declare the scalar variable

You can’t concatenate an int to a string. Instead of: You need: To help illustrate what’s happening here. Let’s say @RowTo = 5. In order to build that into a string (even if ultimately it will be a number), I need to convert it. But as you can see, the number is still treated as … Read more

MySQL ERROR 1290 (HY000) –secure-file-priv option

Ubuntu 16.04 (EASY): Find out where you are allowed to write Then, just write there Mac OSX: Mysql installed via MAMP Find out where you are allowed to write NULL means you’re screwed so you have to create the file “~/.my.cnf” Enable read/write for MySQL installed via MAMP (on Mac): open “MAMP” use spotlight click … Read more