美文网首页
mysql-SQL基础

mysql-SQL基础

作者: 知孺 | 来源:发表于2017-12-17 15:03 被阅读0次

sql在线练习网站 http://sqlzoo.net/wiki/SELECT_basics/zh

在线sql教程 https://www.1keydata.com/cn/sql/

1.模糊搜索

select * from world where continent like 'As%';

2.两个条件 and,or

select * from world where area=468 or area=28748;

3.限制 in

select * from world where area in (468,28748);

4.在范围内

select * from world where area between 0 and 200;

5.排序

select * from world where area between 0 and 200 order by area asc;

6.函数

select avg(area) from world where area between 0 and 200;

avg()平均值,count()计数,max()最大值,min()最小值,sum()总和

7.搜索不重复项

select distinct area from world where area between 0 and 200;

8.分组统计

select name,sum(area) from world group by name;

9.为函数设置条件

select name,sum(area) from world group by name having sum(area)<10000;

10.别名

select name my_name,sum(area) from world group by name having sum(area)<10000;

相关文章

  • MySQL-SQL基础应用+Infomation_Schema介

    MySQL-SQL基础应用+Infomation_Schema介绍-Day3 1、SQL 介绍 2、SQL 作用 ...

  • mysql-SQL基础

    sql在线练习网站 http://sqlzoo.net/wiki/SELECT_basics/zh在线sql教程h...

  • Mysql-sql基础语法

    基础概念 并不直接访问数据库;你使用的是DBMS,它替你访问数据库 模式(schema)与表( table) 的区...

  • MySQL-SQL基础应用

    如果您对数据库感兴趣,可以添加 DBA解决方案QQ群:855439640 1、SQL介绍 2、常用SQL分类 SQ...

  • MySQL-SQL基础应用(SQL基础)

    1、SQL基础应用 1.1 SQL的介绍 1>SQL标准https://blog.csdn.net/weixin_...

  • mysql-sql

    explain分析sql语句的执行情况常用分析字段:key用的索引type索引的使用类型 大致分为 从上到下排序会...

  • mysql基本语法

    mysql-sql 语句 字符集选utf-8 我需要学增删改查, 事物, 联合 启动数据库 mysql -u ro...

  • MySQL-SQL语句

    [TOC] 第一章:MySQL介绍 1.1-什么是SQL Structured Query Language 结构...

  • Mysql-Sql练习

    Sql练习题 1.表和数据的准备 员工表 部门表 工资等级表 2.练习题目 查询出部门编号为30的所有员工的编号和...

  • MySQL-SQL优化

    前言 在应用开发的早期,数据量少,开发人员开发功能时更重视功能上的实现,随着生产数据的增长,很多SQL语句开始暴露...

网友评论

      本文标题:mysql-SQL基础

      本文链接:https://www.haomeiwen.com/subject/kovywxtx.html