当前位置:Gxlcms > 数据库问题 > mysql系列--基础知识大总结

mysql系列--基础知识大总结

时间:2021-07-01 10:21:17 帮助过:4人阅读

u root -p

 技术分享图片

   2、查看所有数据

show databases;

 

   3、使用 某个数据库

use feng;

 

  4、显示选择数据库所有表

show tables;

 

  5、显示某个表结构

desc  table;

 

  6、创建表

  

#基本语法
 
create table name(
       列名  类型   是否为空  默认值  自增   主键,
       列名   类型   是否为空
)ENGINE=InnoDB  DEFAULT CHARSET=utf8

not null    #不为空
default num  #默认值
auto_incrememt  #自增
primary  key   #主键  

 

  7、删除表

drop table  表名

 

8、清空表

delete from 表名
#表还在,数据清空
truncate table 表名

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

        

mysql系列--基础知识大总结

标签:let   sql   基础   pre   .com   数据库   dml   资源   ant   

人气教程排行