How to get size of mysql database?

Run this query and you’ll probably get what you’re looking for: SELECT table_schema “DB Name”, ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) “DB Size in MB” FROM information_schema.tables GROUP BY table_schema; This query comes from the mysql forums, where there are more comprehensive instructions available.

How can I avoid concurrency problems when using SQLite on Android?

Inserts, updates, deletes and reads are generally OK from multiple threads, but Brad’s answer is not correct. You have to be careful with how you create your connections and use them. There are situations where your update calls will fail, even if your database doesn’t get corrupted. The basic answer. The SqliteOpenHelper object holds on … Read more

‘IF’ in ‘SELECT’ statement – choose output value based on column values

SELECT id, IF(type=”P”, amount, amount * -1) as amount FROM report See http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html. Additionally, you could handle when the condition is null. In the case of a null amount: SELECT id, IF(type=”P”, IFNULL(amount,0), IFNULL(amount,0) * -1) as amount FROM report The part IFNULL(amount,0) means when amount is not null return amount else return 0.

MongoDB vs. Cassandra [closed]

Lots of reads in every query, fewer regular writes Both databases perform well on reads where the hot data set fits in memory. Both also emphasize join-less data models (and encourage denormalization instead), and both provide indexes on documents or rows, although MongoDB’s indexes are currently more flexible. Cassandra’s storage engine provides constant-time writes no … Read more

Difference between scaling horizontally and vertically for databases [closed]

Horizontal scaling means that you scale by adding more machines into your pool of resources whereas Vertical scaling means that you scale by adding more power (CPU, RAM) to an existing machine. An easy way to remember this is to think of a machine on a server rack, we add more machines across the horizontal … Read more

What’s the difference between identifying and non-identifying relationships?

An identifying relationship is when the existence of a row in a child table depends on a row in a parent table. This may be confusing because it’s common practice these days to create a pseudokey for a child table, but not make the foreign key to the parent part of the child’s primary key. … Read more

Database, Table and Column Naming Conventions? [closed]

I recommend checking out Microsoft’s SQL Server sample databases: https://github.com/Microsoft/sql-server-samples/releases/tag/adventureworks The AdventureWorks sample uses a very clear and consistent naming convention that uses schema names for the organization of database objects. Singular names for tables Singular names for columns Schema name for tables prefix (E.g.: SchemeName.TableName) Pascal casing (a.k.a. upper camel case)

MyISAM versus InnoDB [closed]

I have briefly discussed this question in a table so you can conclude whether to go with InnoDB or MyISAM. Here is a small overview of which db storage engine you should use in which situation: MyISAM InnoDB —————————————————————- Required full-text search Yes 5.6.4 —————————————————————- Require transactions Yes —————————————————————- Frequent select queries Yes —————————————————————- Frequent … Read more

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