1Multiple field=
2SELECT username, email, COUNT(*)
3FROM users
4GROUP BY username, email
5HAVING COUNT(*) > 1
6
7Single field=
8SELECT _column, COUNT(*)
9FROM _table
10GROUP BY _column
11HAVING COUNT(*) > 1
1CREATE TABLE new_table LIKE original_table;
2INSERT INTO new_table SELECT * FROM original_table;
1• SELECT first_name, COUNT (first_name) FROM employees
2GROUP BY first_name
3HAVING (COUNT(first_name) > 1);
1/*
2First step 1: Duplicate table in SQL (no data is coppied with)
3*/
4
5CREATE TABLE new_table LIKE original_table;
6
7/*
8Sec step 2 : Insert the data (copies the data from original to new)
9*/
10INSERT INTO new_table SELECT * FROM original_table;
11
12
13/*Done!*/
14
1ALTER TABLE Table1
2ADD SubCategory2 {Type of subcategory 1} {NULL|NOT NULL}
3UPDATE Table1 SET SubCategory2 = SubCategory;
4