mysql基础学习(1)

来源:互联网 发布:知乎 撩妹技巧 编辑:程序博客网 时间:2024/06/04 17:59

Mysql 常用操作:

show databases;查看已有的数据库;

create database 数据库名称;
整数(int)int(11)
小数(float,double,decimal) decimal(5,2) 60.22
字符型
char
varchar(255)
日期
date
datetime
timestamp 时间戳


建表
Create table 表名

字段名称  数据类型 

主键
外键约束
非空
Create  table stu
(
Id int primary key not null auto_increment,
姓名
年龄
性别 char(2)
Csrq date 
createtime datetime
)
describe stu; 查看表的设计结构
not null
primary key(id)






insert into stu(id,name,) values(1,”王秋雨”);往表中插入一条数据;
update 表名 set createtime=’’ where id in(1,2) 更新数据
select  字段名(*) from 表名称;

delete from 表名 where id=;

删除表:

drop table table_name

或者是

drop table if exists tb1_name



删除服务
sc delete mysql

原创粉丝点击