日期:2014-05-16 浏览次数:21048 次
mysql> show databases;
+--------------------+
| Database?????????? |
+--------------------+
| information_schema |
| mysql????????????? |
| test?????????????? |
| zst??????????????? |
+--------------------+
4 rows in set (0.00 sec)
mysql> show tables;
ERROR 1046 (3D000): No database selected
mysql> use test;
Database changed
mysql> show tables;
Empty set (0.00 sec)
mysql> use zst;
Database changed
mysql> show tables;
+---------------+
| Tables_in_zst |
+---------------+
| dept????????? |
| emp?????????? |
+---------------+
2 rows in set (0.00 sec)
mysql> desc emp;
+----------+-------------+------+-----+---------+--
| Field??? | Type??????? | Null | Key | Default | E
+----------+-------------+------+-----+---------+--
| empno??? | int(11)???? | NO?? | PRI |???????? |
| ename??? | varchar(10) | YES? |???? | NULL??? |
| job????? | varchar(10) | YES? |???? | NULL??? |
| mgr????? | int(11)???? | YES? |???? | NULL??? |
| hiredate | datetime??? | YES? |???? | NULL??? |
| sal????? | double????? | YES? |???? | NULL??? |
| comm???? | double????? | YES? |???? | NULL??? |
| deptno?? | int(11)???? | YES? | MUL | NULL??? |
+----------+-------------+------+-----+---------+--
8 rows in set (0.00 sec)
mysql> desc dept;
+--------+-------------+------+-----+---------+----
| Field? | Type??????? | Null | Key | Default | Ext
+--------+-------------+------+-----+---------+----
| deptno | int(11)???? | NO?? | PRI |???????? |
| dname? | varchar(14) | YES? |???? | NULL??? |
| loc??? | varchar(13) | YES? |???? | NULL??? |
+--------+-------------+------+-----+---------+----
3 rows in set (0.00 sec)
mysql> insert into dept values(10,'A','A');
Query OK, 1 row affected (0.05 sec)
mysql> insert into dept values(20,'B','B');
Query OK, 1 row affected (0.06 sec)
mysql> insert into dept values(30,'C','C');
Query OK, 1 row affected (0.05 sec)
mysql> insert into dept values(40,'D','D');
Query OK, 1 row affected (0.06 sec)
mysql> insert into dept values(50,'E','E');
Query OK, 1 row affected (0.06 sec)
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
mysql> select * from dept;
+--------+-------+------+
| deptno | dname | loc? |
+--------+-------+------+
|???? 10 | A???? | A??? |
|???? 20 | B???? | B??? |
|???? 30 | C???? | C??? |
|???? 40 | D???? | D??? |
|???? 50 | E???? | E??? |
+--------+-------+------+
5 rows in set (0.00 sec)
mysql> select * from emp;
Empty set (0.00 sec)
mysql> select * from dept limit 3,3
??? -> ;
+--------+-------+------+
| deptno | dname | loc? |
+--------+-------+------+
|???? 40 | D???? | D??? |
|???? 50 | E???? | E??? |
+--------+-------+------+
2 rows in set (0.00 sec)
mysql> create table article(
??? -> id int primary key auto_increment,
??? -> title varchar(255));
Query OK, 0 rows affected (0.09 sec)
mysql> insert into article values(null,'a');
Query OK, 1 row affected (0.06 sec)
mysql> insert into article values(null,'B');
Query OK, 1 row affected (0.06 sec)
mysql> desc article;
+-------+--------------+------+-----+---------+----------------+
| Field | Type???????? | Null | Key | Default | Extra????????? |
+-------+--------------+------+-----+---------+----------------+
| id??? | int(11)????? | NO?? | PRI | NULL??? | auto_increment |
| title | varchar(255) | YES? |???? | NULL??? |??????????????? |
+-------+--------------+------+-----+---------+----------------+
2 rows in set (0.00 sec)
mysql> select * from article;
+----+-------+
| id | title |
+----+-------+
|? 1 | a???? |
|? 2 | B???? |
+----+-------+
2 rows in set (0.00 sec)
mysql> select