MySQL基本用法

MySQL基本操作(注意全英文)
启动:开始-->MySQL Command Line Client
      (用户名:root,密码:   )


显示数据库:show database;
  
使用数据库:use 库名;(use mysql;)


显示数据库表:show tables;


显示表结构:describe 表名;
   如:describe time_zone;




添加记录:insert into 表名 values(各字段值);
   如:insert into tescher values(001,'wustzz','hbut','1975-03-03');


查询记录:select 字段 from 表名 where 条件;
   如:select * from teacher;(全部查)
       select name from teacher where id=001;


删除记录:delete from 表名 where 条件;
   如:delete from teacher;(全部删)
       delete from teacher where id=002;


更新记录:update 表名 set 字段名=值 where 条件;
   如:update teacher set address='wust' where id=002;




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


在数据库中建立表:create table 表名(字段定义);
   如:use school;(不能少)
       create table teacher
       (
         id int(3) not null primary key,
         name char(10),
         address varchar(50),
         year date
       );


删除表:drop table 表名;
   如:drop database 库名;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值