CREATE TABLE profile
(
  id    INT UNSIGNED NOT NULL AUTO_INCREMENT,
  name  VARCHAR(20) NOT NULL,
  birth DATE,
  color ENUM('blue','red','green','brown','black','white'),
  foods SET('lutefisk','burrito','curry','eggroll','fadge','pizza'),
  cats  INT,
  PRIMARY KEY (id)
);

CREATE TABLE IF NOT EXISTS `employees_example` (

  `id` int(11) NOT NULL AUTO_INCREMENT,

  `first_name` varchar(30) NOT NULL,

  `last_name` varchar(40) NOT NULL,

  `position` varchar(25) NOT NULL,

  `home_address` varchar(50) NOT NULL,

  `home_phone` varchar(12) NOT NULL,

  `employee_code` varchar(25) NOT NULL,

  PRIMARY KEY (`id`),

  UNIQUE KEY `employee_code` (`employee_code`),

  KEY `first_name` (`first_name`,`last_name`)

) ENGINE=innodb charset='utf-8';


INSERT INTO `employees_example` (`first_name`, `last_name`, `position`, `home_address`, `home_phone`, `employee_code`)

  VALUES

  ('Mustapha', 'Mond', 'Chief Executive Officer', '692 Promiscuous Plaza', '326-555-3492', 'MM1'),

  ('Henry', 'Foster', 'Store Manager', '314 Savage Circle', '326-555-3847', 'HF1'),

  ('Bernard', 'Marx', 'Cashier', '1240 Ambient Avenue', '326-555-8456', 'BM1'),

  ('Lenina', 'Crowne', 'Cashier', '281 Bumblepuppy Boulevard', '328-555-2349', 'LC1'),

  ('Fanny', 'Crowne', 'Restocker', '1023 Bokanovsky Lane', '326-555-6329', 'FC1'),

  ('Helmholtz', 'Watson', 'Janitor', '944 Soma Court', '329-555-2478', 'HW1');


SHOW INDEXES FROM employees_example;

'RDB > MySQL' 카테고리의 다른 글

xtrabackup 백업 및 복구  (0) 2018.12.31
mysql 테이블 복구 (meta 정보 이상)  (0) 2018.05.10
SQL 튜닝 사례 (부재:Table Charset 표준 위배 사례)  (0) 2018.03.21
mysql online schema chage : gh-ost  (0) 2017.11.20
mysql performance  (0) 2017.11.19

+ Recent posts