MySQL

Best practices

INSERT INTRO Refactoring

Syntax: INSERT INTO database.table () VALUES();

1.

INSERT INTO `coding.categories` (`id`, `title`) VALUES(1, 'Windows Phone');
INSERT INTO `coding.categories` (`id`, `title`) VALUES(2, 'Java');
INSERT INTO `coding.categories` (`id`, `title`) VALUES(3, 'PHP');
INSERT INTO `coding.categories` (`id`, `title`) VALUES(4, 'C#');

2.

USE `coding`;
 
INSERT INTO `categories` (`id`, `title`) VALUES(1, 'Windows Phone');
INSERT INTO `categories` (`id`, `title`) VALUES(2, 'Java');
INSERT INTO `categories` (`id`, `title`) VALUES(3, 'PHP');
INSERT INTO `categories` (`id`, `title`) VALUES(4, 'C#');

3.

USE coding;
 
INSERT INTO categories (id, title) VALUES(1, 'Windows Phone');
INSERT INTO categories (id, title) VALUES(2, 'Java');
INSERT INTO categories (id, title) VALUES(3, 'PHP');
INSERT INTO categories (id, title) VALUES(4, 'C#');

4.

USE coding;
 
INSERT INTO categories (id, title) VALUES
(1, 'Windows Phone'),
(2, 'Java'),
(3, 'PHP'),
(4, 'C#');

Kommentar abgeben

Microsoft Certified Professional Logo
 

Werbung


+Benny Neugebauer