Speed up development with full-stack environments for every branch.

Learn More

INSERT into a table [MySQL]

2763 Runs 5829 Views 584 Copies
Saved

Saved

praful 60

praful
published 4 years ago

/*Create the table*/
CREATE TABLE IF NOT EXISTS `mytable` (
            `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
            `item` VARCHAR(100) NOT NULL,
            `completed` BOOLEAN NOT NULL DEFAULT 0,
            PRIMARY KEY (`id`));



/*Insert data into the table `mytable`*/
INSERT INTO `mytable` (`item`, `completed`) 
VALUES ("Go Shopping", false),
       ("Walk The Dog", false), 
       ("Do the Dishes", true);




/*Print the table*/
SELECT * FROM `mytable`
ORDER BY `id` DESC
LIMIT 20;

TRUNCATE TABLE `mytable`;
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).