×
Clear all filters including search bar
Valeri Tandilashvili's MySQL Notes
sdt_prices_unique
table with exactly the same structure as sdt_prices
table hasCREATE TABLE sdt_prices_unique LIKE sdt_prices
columnname
column UNIQUEALTER TABLE dbname.tablename
ADD UNIQUE (columnname)
Duplicate key
errorINSERT IGNORE INTO dbname.prices_unique
SELECT * FROM dbname.prices
ERROR 2013 (HY000) at line 430: Lost connection to MySQL server during query
Solution to the problem was to increase connection timeout variable by running to following query:SET GLOBAL connect_timeout = 10;
FOREIGN_KEY_CHECKS
to be able to run queries, then we enable FOREIGN_KEY_CHECKS
back
SET FOREIGN_KEY_CHECKS=0;
--- Runs some SQL query - for example deleting some rows from a table that has foreign keys
SET FOREIGN_KEY_CHECKS=1;
decorations
table including column commentsSHOW FULL COLUMNS FROM decorations
is_optional
column comment which exists in decorations
table using information_schema
databaseSELECT COLUMN_COMMENT
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = 'geiger'
AND TABLE_NAME = 'decorations'
AND COLUMN_NAME = 'is_optional'
name
column in channels
tableALTER TABLE `channels` CHANGE `name` `name` varchar(255) COMMENT 'name of channel'
channels
table which exists in the geiger
databaseSELECT table_comment
FROM INFORMATION_SCHEMA.TABLES
WHERE table_schema='geiger'
AND table_name='channels'
ALTER TABLE `the_table_name` comment 'Some text about the table'