zoukankan      html  css  js  c++  java
  • mysql简单命令示例

    C:\mysql\bin>mysql -u root -p
    Enter password: ****
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 4
    Server version: 5.0.51b-community-nt MySQL Community Edition (GPL)

    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | mytest             |
    | tjtz               |
    | tjtz_148280117     |
    +--------------------+
    5 rows in set (0.00 sec)

    mysql> create database mytest2;
    Query OK, 1 row affected (0.01 sec)

    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | mytest             |
    | mytest2            |
    | tjtz               |
    | tjtz_148280117     |
    +--------------------+
    6 rows in set (0.00 sec)

    mysql> use mytest2;
    Database changed
    mysql> create table testTable(
        -> id int(4) auto_increment not null primary key,
        -> name char(10not null,
        -> address char(50default 'jinan',
        -> year date);
    Query OK, 0 rows affected (0.09 sec)

    mysql> show tables;
    +-------------------+
    | Tables_in_mytest2 |
    +-------------------+
    | testtable         |
    +-------------------+
    1 row in set (0.05 sec)

    mysql> insert into testtable values('','zhangsan','','2011-12-29');
    Query OK, 1 row affected, 1 warning (0.00 sec)

    mysql> select * from testtable;
    +----+----------+---------+------------+
    | id | name     | address | year       |
    +----+----------+---------+------------+
    |  1 | zhangsan |         | 2011-12-29 |
    +----+----------+---------+------------+
    1 row in set (0.00 sec)

    mysql> update testtable set address='jiefang road';
    Query OK, 1 row affected (0.06 sec)
    Rows matched: 1  Changed: 1  Warnings: 0

    mysql> select * from testtable;
    +----+----------+--------------+------------+
    | id | name     | address      | year       |
    +----+----------+--------------+------------+
    |  1 | zhangsan | jiefang road | 2011-12-29 |
    +----+----------+--------------+------------+
    1 row in set (0.00 sec)

    mysql> insert into testtable values('','lisi',null,'2012-1-3');
    Query OK, 1 row affected, 1 warning (0.00 sec)

    mysql> select * from testtable;
    +----+----------+--------------+------------+
    | id | name     | address      | year       |
    +----+----------+--------------+------------+
    |  1 | zhangsan | jiefang road | 2011-12-29 |
    |  2 | lisi     | NULL         | 2012-01-03 |
    +----+----------+--------------+------------+
    2 rows in set (0.00 sec)

    mysql>
  • 相关阅读:
    Lucene in action 笔记 case study
    关于Restful Web Service的一些理解
    Lucene in action 笔记 analysis篇
    Lucene in action 笔记 index篇
    Lucene in action 笔记 term vector
    Lucene in action 笔记 search篇
    博客园开博记录
    数论(算法概述)
    DIV, IFRAME, Select, Span标签入门
    记一个较困难的SharePoint性能问题的分析和解决
  • 原文地址:https://www.cnblogs.com/bloodofhero/p/2315023.html
Copyright © 2011-2022 走看看