cmd 下sql语句及结果

Microsoft Windows [版本 10.0.14393]
(c) 2016 Microsoft Corporation。保留所有权利。

C:\Users\李长青>mysql -uroot -h127.0.0.1 -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 164
Server version: 5.6.17 MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use calls1
Database changed
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| calls1 |
| mysql |
| performance_schema |
| test |
+--------------------+
5 rows in set (0.00 sec)

mysql> use calls1
Database changed
mysql> select * from user;
+----+--------+-----+-----+--------+-----+
| id | name | pwd | sex | class1 | tel |
+----+--------+-----+-----+--------+-----+
| 3 | | | | | |
| 54 | 李长青 | 123 | 男 | 应用 | 521 |
| 53 | | | | | |
+----+--------+-----+-----+--------+-----+
3 rows in set (0.00 sec)

mysql> describe user ;
+--------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------+------------------+------+-----+---------+----------------+
| id | int(11) unsigned | NO | PRI | NULL | auto_increment |
| name | varchar(50) | NO | | NULL | |
| pwd | varchar(50) | NO | | NULL | |
| sex | varchar(10) | NO | | NULL | |
| class1 | varchar(50) | NO | | NULL | |
| tel | varchar(50) | NO | | NULL | |
+--------+------------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)

mysql> delete from user where id"3";
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"3"' at line 1
mysql> delete from user where id='3';
Query OK, 1 row affected (0.00 sec)

mysql> use calls1
Database changed
mysql> create table user001(
-> id int auto_increment primary key,
-> user varchar(50) not null,
-> pwd varchar(50) not null,
-> createtime datetime);
Query OK, 0 rows affected (0.27 sec)

mysql> use user001
ERROR 1049 (42000): Unknown database 'user001'
mysql> describe user001;
+------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| user | varchar(50) | NO | | NULL | |
| pwd | varchar(50) | NO | | NULL | |
| createtime | datetime | YES | | NULL | |
+------------+-------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)

mysql>

posted on 2017-11-30 11:40  大牛李  阅读(177)  评论(0编辑  收藏  举报

导航