Skip to main content

Posts

Showing posts with the label Mysql query

MySql query used in projects

Mysql Query Helps you in Project 1. Copy data of one table to another  CREATE TABLE student2 SELECT * FROM student;     or CREATE TABLE student2 LIKE student; INSERT student2 SELECT * FROM student; 2. Copy structure of one table onto another but not data  CREATE TABLE student2 SELECT * FROM student WHERE 1=0 3. Insert data into table form another table on id basis   INSERT INTO student2 SELECT * FROM student WHERE id = 2; 4. Update the record in table Update students set first_name=’Sudhir’ where id=2; 5. Create table query CREATE TABLE IF NOT EXISTS `cities` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `country_id` int(10) unsigned DEFAULT NULL, `state_id` int(10) unsigned DEFAULT NULL, `name` varchar(100) NOT NULL DEFAULT '', `created` datetime DEFAULT NULL, `modified` datetime DEFAULT NULL, PRIMARY KEY (`id`), KEY `name` (`name`), KEY `country_id` (`country_id`) ) ENGINE=InnoDB 6. Delete Command DELET...