storing negative value in mysql
Use MySQL DECIMAL type? Standard SQL requires that DECIMAL(5,2) be able to store any value with five digits and two decimals, so values that can be stored in the salary column range from -999.99 to 999.99
Use MySQL DECIMAL type? Standard SQL requires that DECIMAL(5,2) be able to store any value with five digits and two decimals, so values that can be stored in the salary column range from -999.99 to 999.99
You need to specify the primary key as auto-increment CREATE TABLE `momento_distribution` ( `momento_id` INT(11) NOT NULL AUTO_INCREMENT, `momento_idmember` INT(11) NOT NULL, `created_at` DATETIME DEFAULT NULL, `updated_at` DATETIME DEFAULT NULL, `unread` TINYINT(1) DEFAULT ‘1’, `accepted` VARCHAR(10) NOT NULL DEFAULT ‘pending’, `ext_member` VARCHAR(255) DEFAULT NULL, PRIMARY KEY (`momento_id`, `momento_idmember`), KEY `momento_distribution_FI_2` (`momento_idmember`), KEY `accepted` (`accepted`, `ext_member`) … Read more
INSERT … SELECT http://dev.mysql.com/doc/refman/5.1/en/insert-select.html INSERT INTO newsletter_to_send SELECT id_subscriber FROM subscribers PS: are you sure you don’t need in WHERE clause?
Got this error on Windows because my mysqld.exe wasn’t running. Ran “C:\Program Files\MySQL\MySQL Server 5.5\bin\mysqld” –install from the command line to add it to my services, ran services.msc (start -> run), found the MySQL service and started it. Didn’t have to worry about it from there on out.
In general: Database and table names are not case sensitive in Windows, and case sensitive in most varieties of Unix. In MySQL, databases correspond to directories within the data directory. Each table within a database corresponds to at least one file within the database directory. Consequently, the case sensitivity of the underlying operating system plays … Read more
Use this query: SELECT User FROM mysql.user; Which will output a table like this: +——-+ | User | +——-+ | root | +——-+ | user2 | +——-+ As Matthew Scharley points out in the comments on this answer, you can group by the User column if you’d only like to see unique usernames.