Skip to content

Instantly share code, notes, and snippets.

@Devcodpanda
Created May 25, 2020 16:19
Show Gist options
  • Save Devcodpanda/0f5e70854c98dda6a797ad64227158d9 to your computer and use it in GitHub Desktop.
Save Devcodpanda/0f5e70854c98dda6a797ad64227158d9 to your computer and use it in GitHub Desktop.
➜ ~ nano db.sql
➜ ~ mysql -u root -D wild_db_quest -p
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
...
mysql> DESCRIBE wizard;
+-------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+----------------+
| id | int | NO | PRI | NULL | auto_increment |
| firstname | varchar(100) | NO | | NULL | |
| lastname | varchar(100) | NO | | NULL | |
| birthday | date | NO | | NULL | |
| birth_place | varchar(255) | YES | | NULL | |
| biography | text | YES | | NULL | |
+-------------+--------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)
mysql> ALTER TABLE wizard ADD is_muggle BOOLEAN;
Query OK, 0 rows affected (0.03 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> CREATE TABLE school ( id INT PRIMARY KEY NOT NULL AUTO_INCREMENT, name VARCHAR(100) NOT NULL, capacity INT, country CHARVAR(255) NOT NULL);
Query OK, 0 rows affected (0.02 sec)
mysql> DESCRIBE school;
+----------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+----------------+
| id | int | NO | PRI | NULL | auto_increment |
| name | varchar(100) | NO | | NULL | |
| capacity | int | YES | | NULL | |
| country | varchar(255) | NO | | NULL | |
+----------+--------------+------+-----+---------+----------------+
4 rows in set (0.01 sec)
mysql> DESCRIBE wizard
-> ;
+-------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+----------------+
| id | int | NO | PRI | NULL | auto_increment |
| firstname | varchar(100) | NO | | NULL | |
| lastname | varchar(100) | NO | | NULL | |
| birthday | date | NO | | NULL | |
| birth_place | varchar(255) | YES | | NULL | |
| biography | text | YES | | NULL | |
| is_muggle | tinyint(1) | YES | | NULL | |
+-------------+--------------+------+-----+---------+----------------+
7 rows in set (0.00 sec)
mysql> SHOW TABLES;
+-------------------------+
| Tables_in_wild_db_quest |
+-------------------------+
| school |
| wizard |
+-------------------------+
2 rows in set (0.00 sec)
mysql>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment