I would like to know how many rows are in each table in my database. I’ve come so far as to having However i would need to do that on each and every table – and there are a lot. What would me the best way to get a print-out with the table name and it’s row count? Answer I
Tag: mysql
GROUP BY – do not group NULL
I’m trying to figure out a way to return results by using the group by function. GROUP BY is working as expected, but my question is: Is it possible to have a group by ignoring the NULL field. So that it does not group NULLs together because I still need all the rows where the specified field is NULL. So
MySQL “IN” operator performance on (large?) number of values
I have been experimenting with Redis and MongoDB lately and it would seem that there are often cases where you would store an array of id’s in either MongoDB or Redis. I’ll stick with Redis for this question since I am asking about the MySQL IN operator. I was wondering how performant it is to list a large number (300-3000)
SQL Query merging with PHP assistance please
I want to sort the messages by poster_time instead of the usual id incrementing as I have restored a database with auto incrementing id’s and very old messages show up on top I had like to be able to sort them by poster_time to fix that problem. I’ve attempted to fix this myself but I don’t want to lose any
Mysql SELECT CASE WHEN something then return field
I have two field nnmu and nnmi , and reverse, At first everything looks good, but somehow it mix up values, it work when nnmi and nnmu both are equal to 0, but when either value is 1 it returns nonsense. Any help? Answer You are mixing the 2 different CASE syntaxes inappropriately. Use this style (Searched) Or this style
What is dynamic SQL?
I just asked an SQL related question, and the first answer was: “This is a situation where dynamic SQL is the way to go.” As I had never heard of dynamic SQL before, I immediately searched this …
SQL UPDATE all values in a field with appended string CONCAT not working
Here is what I want to do: current table: Mystery Query ( something like “UPDATE table SET data = CONCAT(data, ‘a’)” ) resulting table: thats it! I just need to do it in a single query, but can’t seem to find a way. I am using mySQL on bluehost (I think its version 4.1) Thanks everyone. Answer That’s pretty much
mysql Creating a temporary table not working…undeclared variable error…whats wrong with my code?
When I run the code below inside phpmyadmin I get an error “Undefined Variable tmpportfolio” what is the problem? SQL: CREATE TEMPORARY TABLE tmpportfolio (p_name VARCHAR(255),portfolio_id INT …
MySQL Update Column +1?
I was wondering what would be the easiest way to update a column by +1? I will be updating a post count of a category based on when users submits a new post. Thanks.
SQL statement to get all customers with no orders
I have a typical Persons table and an Orders table defined in such a way that I can do JOIN query as the following to return Orders for all Persons. The question is, how do I write a statement that would return all Persons with NO Orders? I’m using mysql. Thank all in advance. Answer You may want to use