MySQL常用语法
技术百科
正念的奇迹
发布时间:2017-08-08
浏览: 次 显示有哪些数据库:show databases;
创建数据库:create database database1;
删除数据库:drop database database1;
使用数据库:use database1;
查看表:show tables;
新建表:create table table1(
id int(10) not null primary key auto increment ,
a varchar(20),
b int(10),
c varchar(10) default '男',
d int(10)
);
查看表结构:desc student;
删除表:drop table student;
删除主键:alter table table1 drop primary key;
增加主键:alter table table1 add primary key(id);
删除字段:alter table table1 drop classid;
增加字段:alter table table1 add classid int(10);
增加记录:insert into table1(a,b,c,d) values('哈哈',1,'你好',2);
删除:delete from table1 where b = 1;
修改:update table1 set a = '哈哈哈' where b=1;
通配符 %:多个任意的字符 _:一个字符
update table1 set b = 2 where name like '%i%';
查询:
select * from table1;
select id,name from table1;
select * from table1 where b like '%i%';
排序 默认升序asc 降序desc
select * from table1 order by a asc;
select * from table1 order by a desc;
select * from table1 order by a desc,b asc;
组函数 min max count avg
select count(*) from table1;
select min(a) from table1;
select avg(a) from table1;
select max(a) from table1;
分组:select classid,avg(b) from table1 group by classid having avg(b)>5;
字句作为查询的条件:select * from table1 where age = (select min(b) from table1);
# 多个
# 有哪些
# mysql
# 主键
# 升序
# 降序
# 你好
# 看表
# key
# primary
# increment
相关栏目:
<?muma
$count = M('archives')->where(['typeid'=>$field['id']])->count();
?>
【
AI推广<?muma echo $count; ?>
】
<?muma
$count = M('archives')->where(['typeid'=>$field['id']])->count();
?>
【
SEO优化<?muma echo $count; ?>
】
<?muma
$count = M('archives')->where(['typeid'=>$field['id']])->count();
?>
【
技术百科<?muma echo $count; ?>
】
<?muma
$count = M('archives')->where(['typeid'=>$field['id']])->count();
?>
【
谷歌推广<?muma echo $count; ?>
】
<?muma
$count = M('archives')->where(['typeid'=>$field['id']])->count();
?>
【
百度推广<?muma echo $count; ?>
】
<?muma
$count = M('archives')->where(['typeid'=>$field['id']])->count();
?>
【
网络营销<?muma echo $count; ?>
】
<?muma
$count = M('archives')->where(['typeid'=>$field['id']])->count();
?>
【
案例网站<?muma echo $count; ?>
】
<?muma
$count = M('archives')->where(['typeid'=>$field['id']])->count();
?>
【
精选文章<?muma echo $count; ?>
】
相关推荐
- php会话怎么开启_session_start函数
- php转exe用什么工具打包快_高效打包软件推荐【
- mac怎么查看wifi密码_MAC查看已连接WiF
- Win11怎么设置麦克风权限_允许应用访问Win1
- c++ try_emplace用法_c++ map
- Win11如何连接Xbox手柄 Win11蓝牙连接
- 如何使用Golang处理静态文件缓存_提高页面加载
- Windows蓝屏错误0x0000001E怎么修复
- Win10如何优化内存使用_Win10内存优化技巧
- 如何在Golang中实现微服务负载均衡_Golan
- 如何使用正则表达式批量替换重复的 *- 模式为固定
- 如何用正则与预处理高效拦截带干扰符的恶意域名
- Windows10如何更改桌面背景_Win10个性
- Linux怎么修改用户密码_Linux系统pass
- Windows10系统怎么查看显卡驱动_Win10
- 如何使用Golang优化模块引入路径_Golang
- 如何在 Go 中调用动态链接库(.so)中的函数
- Win11怎么设置虚拟内存_Windows 11优
- Win11 C盘满了怎么清理 Win11磁盘清理和
- c++如何使用std::bind绑定函数参数_c+
- 如何将竖排文本文件转换为横排字符串
- php打包exe后无法读取环境变量_变量配置方法【
- 如何在Mac上搭建Golang开发环境_使用Hom
- Windows10如何更改系统字体大小_Win10
- 新手学PHP架构总混淆概念咋办_重点梳理【教程】
- windows 10应用商店区域怎么改_windo
- c++ reinterpret_cast怎么用 c
- Win10怎样安装PPT模板_Win10安装PPT
- 如何用::实现工具类方法调用_php静态工具类设计
- php能控制zigbee模块吗_php通过串口与c
- Win11怎么关闭任务栏小组件_Windows11
- Win11怎样安装剪映专业版_Win11安装剪映教
- c++的mutex和lock_guard如何使用
- Win11怎么修复系统文件_使用sfc命令修复Wi
- Win11如何隐藏桌面图标 Win11一键隐藏/显
- Win10怎么卸载鲁大师_Win10彻底卸载鲁大师
- c++怎么使用std::filesystem遍历文
- php增删改查报错1054怎么办_字段名错误排查修
- 如何使用Golang模拟请求超时_Golang c
- php查询数据怎么导出csv_查询结果转csv文件
- c++怎么使用类型萃取type_traits_c+
- PhpStorm怎么调试PHP代码_PhpStor
- Win11如何卸载OneDrive_Win11卸载
- 如何在Golang中理解指针比较_Golang地址
- 如何使用Golang实现路由参数绑定_使用Mux和
- Win10怎么查看内存时序参数_Win10CPU-
- Win10怎么卸载爱奇艺_Win10彻底卸载爱奇艺
- MySQL 中使用 IF 和 CASE 实现查询字
- Mac如何备份到iCloud_Mac桌面与文稿文件
- MAC怎么一键隐藏桌面所有图标_MAC极简模式切换

QQ客服