daily pastebin goal
65%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE TABLE employees(
  2.     id INT AUTO_INCREMENT,
  3.     name VARCHAR(40) NOT NULL,
  4.     description VARCHAR(50) DEFAULT 'No Description',
  5.     random_assignment_id INT UNIQUE,
  6.     birth_date DATE,
  7.     salary DECIMAL(5,2),
  8.     supervisor_id INT,
  9.     branch_id INT NOT NULL,
  10.     created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  11.     updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  12.     CONSTRAINT random_assignment_check CHECK (LENGTH(random_assignment_id) = 5),
  13.     INDEX(random_assignment_id, supervisor_id, branch_id),
  14.     PRIMARY KEY(id)
  15. )
  16.    
  17. SHOW CREATE TABLE employeesG;
  18. *************************** 1. row ***************************
  19.        Table: employees
  20. Create Table: CREATE TABLE `employees` (
  21.   `id` int(11) NOT NULL AUTO_INCREMENT,
  22.   `name` varchar(40) NOT NULL,
  23.   `description` varchar(50) DEFAULT 'No Description',
  24.   `random_assignment_id` int(11) DEFAULT NULL,
  25.   `birth_date` date DEFAULT NULL,
  26.   `salary` decimal(5,2) DEFAULT NULL,
  27.   `supervisor_id` int(11) DEFAULT NULL,
  28.   `branch_id` int(11) NOT NULL,
  29.   `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  30.   `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  31.   PRIMARY KEY (`id`),
  32.   UNIQUE KEY `random_assignment_id` (`random_assignment_id`),
  33.   KEY `random_assignment_id_2` (`random_assignment_id`,`supervisor_id`,`branch_id`)
  34. ) ENGINE=InnoDB DEFAULT CHARSET=utf8
  35. 1 row in set (0.01 sec)
  36.    
  37. DESCRIBE employees;
  38. +----------------------+--------------+------+-----+-------------------+----------------+
  39. | Field                | Type         | Null | Key | Default           | Extra          |
  40. +----------------------+--------------+------+-----+-------------------+----------------+
  41. | id                   | int(11)      | NO   | PRI | NULL              | auto_increment |
  42. | name                 | varchar(40)  | NO   |     | NULL              |                |
  43. | description          | varchar(50)  | YES  |     | No Description    |                |
  44. | random_assignment_id | int(11)      | YES  | UNI | NULL              |                |
  45. | birth_date           | date         | YES  |     | NULL              |                |
  46. | salary               | decimal(5,2) | YES  |     | NULL              |                |
  47. | supervisor_id        | int(11)      | YES  |     | NULL              |                |
  48. | branch_id            | int(11)      | NO   |     | NULL              |                |
  49. | created_at           | timestamp    | NO   |     | CURRENT_TIMESTAMP |                |
  50. | updated_at           | timestamp    | NO   |     | CURRENT_TIMESTAMP |                |
  51. +----------------------+--------------+------+-----+-------------------+----------------+
  52.    
  53. brew info mariadb
  54. mariadb: stable 10.3.12 (bottled)
  55. Drop-in replacement for MySQL
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top