zoukankan      html  css  js  c++  java
  • MySOL数据库的建立以及表的增删改查

    客户端登录服务器方式 mysql -u用户名 -p密码

    建立数据库:create database 数据库名;

    使用数据库:use 数据库名;

    建表 :create table stu(

      id int,

      name varchar(10)

      )engine myisam charset utf8;

    清空表:truncate stu;

    truncate相当于删表再重建一张相同结构的表。

    而delete相当于用橡皮擦把表的数据库擦掉。

    如果决定全清空的话truncate更快。

    改表名:rename table stu to newstu;

    查看表:select * from stu;

    删除表:drop table stu;

    建表:

    mysql> create table class(
    -> id int primary key auto_increment,
    -> sname varchar(10) not null default '',
    -> gender char(1) not null default '',
    -> company varchar(20) not null default '',
    -> salary decimal(6,2) not null default 0.00,
    -> fanbu smallint not null default 0
    -> )engine myisam charset utf8;

  • 相关阅读:
    select函数
    ascy_finder|base|cookie 代码测试
    正则表达式之道
    教务系统破解
    jquery API
    test
    如何获取和发送Http请求和相应
    header中ContentDisposition的作用
    Performance Testing 系列
    LINQ
  • 原文地址:https://www.cnblogs.com/jundima/p/10171243.html
Copyright © 2011-2022 走看看