Skip to content

Instantly share code, notes, and snippets.

@WesJD
Created June 26, 2018 20:57
Show Gist options
  • Save WesJD/a5e2ef295ab462d45a0f76f743b7aac4 to your computer and use it in GitHub Desktop.
Save WesJD/a5e2ef295ab462d45a0f76f743b7aac4 to your computer and use it in GitHub Desktop.
MariaDB [(none)]> use michelle;
MariaDB [michelle]> create table items (type VARCHAR(75) NOT NULL, broken BOOL NOT NULL, used BOOL NOT NULL DEFAULT TRUE, got_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, last_used TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP);Query OK, 0 rows affected (0.01 sec)
MariaDB [michelle]> DESCRIBE items;
+-----------+-------------+------+-----+-------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+-------------------+-------+
| type | varchar(75) | NO | | NULL | |
| broken | tinyint(1) | NO | | NULL | |
| used | tinyint(1) | NO | | 1 | |
| got_date | timestamp | NO | | CURRENT_TIMESTAMP | |
| last_used | timestamp | NO | | CURRENT_TIMESTAMP | |
+-----------+-------------+------+-----+-------------------+-------+
5 rows in set (0.00 sec)
MariaDB [michelle]> drop table items;
Query OK, 0 rows affected (0.00 sec)
MariaDB [michelle]> create table items (type VARCHAR(75) NOT NULL, broken BOOL NOT NULL, used BOOL NOT NULL DEFAULT TRUE, got_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, last_used TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE (type));
Query OK, 0 rows affected (0.01 sec)
MariaDB [michelle]> DESCRIBE items;
+-----------+-------------+------+-----+-------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+-------------------+-------+
| type | varchar(75) | NO | PRI | NULL | |
| broken | tinyint(1) | NO | | NULL | |
| used | tinyint(1) | NO | | 1 | |
| got_date | timestamp | NO | | CURRENT_TIMESTAMP | |
| last_used | timestamp | NO | | CURRENT_TIMESTAMP | |
+-----------+-------------+------+-----+-------------------+-------+
5 rows in set (0.01 sec)
MariaDB [michelle]> INSERT INTO items (type) VALUES ("dresser");
Query OK, 1 row affected, 1 warning (0.00 sec)
MariaDB [michelle]> select * from items;
+---------+--------+------+---------------------+---------------------+
| type | broken | used | got_date | last_used |
+---------+--------+------+---------------------+---------------------+
| dresser | 0 | 1 | 2018-06-26 20:38:33 | 2018-06-26 20:38:33 |
+---------+--------+------+---------------------+---------------------+
1 row in set (0.00 sec)
MariaDB [michelle]> INSERT INTO items (type) VALUES ("soap");
Query OK, 1 row affected, 1 warning (0.00 sec)
MariaDB [michelle]> INSERT INTO items (type, broken, used, got_date, last_used) VALUES ("cup", TRUE, TRUE, NOW(), NOW()-INTERVAL 1 WEEK);
Query OK, 1 row affected (0.00 sec)
MariaDB [michelle]> SELECT * FROM items;
+---------+--------+------+---------------------+---------------------+
| type | broken | used | got_date | last_used |
+---------+--------+------+---------------------+---------------------+
| cup | 1 | 1 | 2018-06-26 20:51:51 | 2018-06-19 20:51:51 |
| dresser | 0 | 1 | 2018-06-26 20:38:33 | 2018-06-26 20:38:33 |
| soap | 0 | 1 | 2018-06-26 20:44:46 | 2018-06-26 20:44:46 |
+---------+--------+------+---------------------+---------------------+
3 rows in set (0.00 sec)
MariaDB [michelle]> SELECT type FROM items;
+---------+
| type |
+---------+
| cup |
| dresser |
| soap |
+---------+
3 rows in set (0.00 sec)
MariaDB [michelle]> SELECT type, got_date FROM items;
+---------+---------------------+
| type | got_date |
+---------+---------------------+
| cup | 2018-06-26 20:51:51 |
| dresser | 2018-06-26 20:38:33 |
| soap | 2018-06-26 20:44:46 |
+---------+---------------------+
3 rows in set (0.00 sec)
MariaDB [michelle]>
@wjdmom
Copy link

wjdmom commented Jul 5, 2018

Thank you for helping me with this. Here is my attempt at three different tables.

DESCRIBE michellepp1;
INSERT INTO michellepp1 (“task name”, “task description”, sequence, dependancy, accountable, “target completion”); VALUES (“Part Number Removed To Auxiliary List”, “Customer Assessments”, “review contracts”, “remediation plan to sales”, “customer communication plan”, “Infor communication plan”, “stop selling”, “extended support ends”, “premire support ends”, “sustaining support ends”, ‘DC ends hosting”, “RA Available to all customers”);

DESCRIBE michellepp1dates
INSERT INTO michellepp1dates (“Task Name”, Accountable, Sequence, dependancy ); VALUES (ES, EF, LS, LF, “Target Completion”);

DESCRIBE michellepp1approvals
INSERT INTO michellepp1dates (“Task Name”, “approval date”); VALUES (VP)

DESCRIBE michellepp1raci
INSERT INTO michellepp1dates (responsible, accountable, consulted, informed); VALUES (“Part Number Removed To Auxiliary List”, “Customer Assessments”, “review contracts”, “remediation plan to sales”, “customer communication plan”, “Infor communication plan”, “stop selling”, “extended support ends”, “premire support ends”, “sustaining support ends”, ‘DC ends hosting”, “RA Available to all customers”, completed);

@wjdmom
Copy link

wjdmom commented Jul 5, 2018

oops-found a mistake. here it is again without the mistake that I found:

DESCRIBE michellepp1;
INSERT INTO michellepp1 (“task name”, “task description”, sequence, dependancy, accountable, “target completion”); VALUES (“Part Number Removed To Auxiliary List”, “Customer Assessments”, “review contracts”, “remediation plan to sales”, “customer communication plan”, “Infor communication plan”, “stop selling”, “extended support ends”, “premire support ends”, “sustaining support ends”, ‘DC ends hosting”, “RA Available to all customers”);

DESCRIBE michellepp1dates
INSERT INTO michellepp1dates (“Task Name”, Accountable, Sequence, dependancy ); VALUES (ES, EF, LS, LF, “Target Completion”);

DESCRIBE michellepp1approvals
INSERT INTO michellepp1dates (“Task Name”, “approval date”); VALUES (“VP name”, “approval date”)

DESCRIBE michellepp1raci
INSERT INTO michellepp1dates (responsible, accountable, consulted, informed); VALUES (“Part Number Removed To Auxiliary List”, “Customer Assessments”, “review contracts”, “remediation plan to sales”, “customer communication plan”, “Infor communication plan”, “stop selling”, “extended support ends”, “premire support ends”, “sustaining support ends”, ‘DC ends hosting”, “RA Available to all customers”, completed);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment