Category: Mysql
-
How to generate a CREATE TABLE statement for a given table in Mysql
Just use SHOW CREATE TABLE SHOW CREATE TABLE my_table See also: How to generate a CREATE TABLE statement for a given table in SQL Server How to generate a CREATE TABLE statement for a given table in Oracle How to generate a CREATE TABLE statement for a given table in SQLite Some MySQL tools you…
-
Remove duplicate rows in MySQL
The primary key: id, the unique columns: col_1, col_2, col_3 . You can use a temporary table, like: create temporary table temp_table (id int); insert temp_table (id) select id from your_table t1 where exists ( select * from your_table t2 where t2.col_1 = t1.col_1 and t2.col_2 = t1.col_2 and t2.col_3 = t1.col_3 and t2.id >…
-
How to get column names from Mysql table
We can use information_schema.columns for getting column information SELECT column_name FROM information_schema.columns WHERE table_schema = ‘My_Schema_Name’ AND table_name = ‘My_Table_Name’ See also: How to get column names from Sql Server table How to get column names from DB2 table How to get column names from Oracle table How to get column names from PostgreSQL table…