【MySql】学习笔记(一)

1、Mysql 添加、删除数据库、添加、删除数据表

查看当前库下DB / tables:   show databases; /  show tables;

进入数据库:                           use xx

添加DB / tables:                   create database  xx ; / 

                                                   create table account(

                                                   lie1 varchar(255),

                                                   lie2 varchar(255),

                                                   lie3 varchar(255)

                                                   );

删除DB / tables                      drop database xx ;

                                                   drop table XX;

2、MySql 数据修改

增加列:                                  alert  table [table_name] add [column_name] [data_type] [not null] [default] ;

                                 eg:           alert table account add c1 int (11) not null default 1 ;

删除列:                                  alert table [table_name] drop [column_name];

                                eg:            alert table account drop c1;

修改列:                                  alert table [table_name] change [old_column_name] [new_column_name][data_type]

修改表名:                              alert table [table_name] rename [new_table_name];

插入表中数据:                       insert into [table_name] (列表) values (值)

更新表中数据:                      update [table_name] set [column_name] = xx [ where]


3、Mysql 数据类型

分为:文本类、日期类、数字类型

常用的有 varchar(size) 长度可变、 Text 文章首选、Longtext 小说等长文本、TinYint、 int、 Bigint、double类型、Date()[年 月 日]  、Datetime()[年 月 日+ 时间] 


再更 学习笔记(二)

4.MySql 查找

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Keyli0n

赠人玫瑰 手有余香

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值