MySQL学习的表单定义
mysql> select database();
+-------------+
| database() |
+-------------+
| myemployees |
+-------------+
1 row in set (0.00 sec)
mysql> show tables;
+-----------------------+
| Tables_in_myemployees |
+-----------------------+
| departments |
| employees |
| job_grades |
| jobs |
| locations |
+-----------------------+
5 rows in set (0.00 sec)
mysql> desc departments;
+-----------------+------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+------------+------+-----+---------+----------------+
| department_id | int(4) | NO | PRI | NULL | auto_increment |
| department_name | varchar(3) | YES | | NULL | |
| manager_id | int(6) | YES | | NULL | |
| location_id | int(4) | YES | MUL | NULL | |
+-----------------+------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)
mysql> desc employees;
+----------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+--------------+------+-----+---------+----------------+
| employee_id | int(6) | NO | PRI | NULL | auto_increment |
| first_name | varchar(20) | YES | | NULL | |
| last_name | varchar(25) | YES | | NULL | |
| email | varchar(25) | YES | | NULL | |
| phone_number | varchar(20) | YES | | NULL | |
| job_id | varchar(10) | YES | MUL | NULL | |
| salary | double(10,2) | YES | | NULL | |
| commission_pct | double(4,2) | YES | | NULL | |
| manager_id | int(6) | YES | | NULL | |
| department_id | int(4) | YES | MUL | NULL | |
| hiredate | datetime | YES | | NULL | |
+----------------+--------------+------+-----+---------+----------------+
11 rows in set (0.00 sec)
mysql> desc job_grades;
+-------------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+------------+------+-----+---------+-------+
| grade_level | varchar(3) | YES | | NULL | |
| lowest_sal | int(11) | YES | | NULL | |
| highest_sal | int(11) | YES | | NULL | |
+-------------+------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
mysql> desc jobs;
+------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+-------+
| job_id | varchar(10) | NO | PRI | NULL | |
| job_title | varchar(35) | YES | | NULL | |
| min_salary | int(6) | YES | | NULL | |
| max_salary | int(6) | YES | | NULL | |
+------------+-------------+------+-----+---------+-------+
4 rows in set (0.00 sec)
mysql> desc locations;
+----------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------+-------------+------+-----+---------+----------------+
| location_id | int(11) | NO | PRI | NULL | auto_increment |
| street_address | varchar(40) | YES | | NULL | |
| postal_code | varchar(12) | YES | | NULL | |
| city | varchar(30) | YES | | NULL | |
| state_province | varchar(25) | YES | | NULL | |
| country_id | varchar(2) | YES | | NULL | |
+----------------+-------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)
mysql> select database();
+------------+
| database() |
+------------+
| girls |
+------------+
1 row in set (0.00 sec)
mysql> show tables;
+-----------------+
| Tables_in_girls |
+-----------------+
| admin |
| beauty |
| boys |
+-----------------+
3 rows in set (0.00 sec)
mysql> desc admin;
+----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| username | varchar(10) | NO | | NULL | |
| password | varchar(10) | NO | | NULL | |
+----------+-------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)
mysql> desc beauty;
+--------------+-------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+-------------+------+-----+---------------------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(50) | NO | | NULL | |
| sex | char(1) | YES | | 女 | |
| borndate | datetime | YES | | 1987-01-01 00:00:00 | |
| phone | varchar(11) | NO | | NULL | |
| photo | blob | YES | | NULL | |
| boyfriend_id | int(11) | YES | | NULL | |
+--------------+-------------+------+-----+---------------------+----------------+
7 rows in set (0.00 sec)
mysql> desc boys;
+---------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| boyName | varchar(20) | YES | | NULL | |
| userCP | int(11) | YES | | NULL | |
+---------+-------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)