当前位置:网站首页>SQL 练习(一)
SQL 练习(一)
2022-04-23 11:56:00 【抄代码抄错的小牛马】
目录
学习SQL有段时间了,想要更加熟练的掌握它,那就只有刷题咯~~~
-
SQL篇之非技术快速入门
-
基础查询
-
查询所有列

代码:select 语句
select * from user_profile
-
查询多列

代码:从表中select出:设备ID,性别,年龄学校列名就OK
select device_id,gender,age,university --设备ID,性别,年龄学校
from user_profile
-
查询结果去重

代码:distinct 去重
select distinct university
FROM user_profile
-
查询结果限制返回行数
代码:where条件查询
select device_id
from user_profile
where id<=2
- 将查询后的列重新命名

代码:as重命名,重命名还有:
select device_id as user_infos_example
from user_profile
where id<=2
-
条件查询
- 查找后排序

代码:order by 列名 asc/desc asc 升序,desc 降序,默认排序为升序
select device_id,age from user_profile order by age
-
查找后多列排序

代码:
select device_id, gpa, age from user_profile
order by gpa asc, age asc
- 查找后降序排列

代码:desc 降序排列
select device_id,gpa,age
from user_profile
order by gpa desc,age desc
-
查找学校是北大的学生信息

代码:where 语句条件查询
select device_id,university
from user_profile
where university='北京大学'
-
查找年龄大于24的用户

代码:
select device_id,gender,age,university
from user_profile
where age>24
-
查找某个年龄段的用户信息

代码:and并列条件
select device_id,gender,age
from user_profile
where age>=20 and age<=23
-
查找除复旦大学的用户信息
代码:!= 不等于
select device_id, gender, age, university
from user_profile
where university != '复旦大学'
-
用where过滤空值练习

代码:
select device_id,gender,age,university
from user_profile
where age !=' '

版权声明
本文为[抄代码抄错的小牛马]所创,转载请带上原文链接,感谢
https://yuanxinghua.blog.csdn.net/article/details/124336436
边栏推荐
- Analyzing the role of social robots in basic science
- Force buckle - 70 climb stairs
- 同态加密技术学习
- IM表达式如何工作(5.3)
- 科创人·派拉软件CEO谭翔:零信任本质是数字安全,To B也要深研用户心智
- 软件测试对于减少程序BUG有多大帮助?
- 1.Electron开发环境搭建
- redis优化系列(二)Redis主从原理、主从常用配置
- ImportError: libX11.so.6: cannot open shared object file: No such file or directory
- 第四章 为物化视图启用和禁用IM列存储(IM 4.6)
猜你喜欢

Running error: unable to find or load the main class com xxx. Application

On lambda powertools typescript

论文解读(CGC)《CGC: Contrastive Graph Clustering for Community Detection and Tracking》

Relu function of activation function
![[web daily practice] eight color puzzle (float)](/img/59/474080f6377b3684aa4fb2a39e1d81.png)
[web daily practice] eight color puzzle (float)

Tensorflow使用keras创建神经网络的方法

Here comes the detailed picture and text installation tutorial of H5 game

Interpretation 3 of gdpr series: how do European subsidiaries return data to domestic parent companies?

rebbitMQ的简单搭建

Share two practical shell scripts
随机推荐
如果你是一个Golang面试官,你会问哪些问题?
外包干了五年,废了...
VMware虚拟机使用esxi 导出硬盘vmdk文件
项目实训-火爆辣椒
Sigmoid function of activation function
Siri gave the most embarrassing social death moment of the year
Yunna | fixed assets inventory supports multiple inventory methods (asset inventory)
IM表达式的目的(IM 5.2)
一文详解头部位姿估计【收藏好文】
欣旺达宣布电池产品涨价 此前获“蔚小理”投资超10亿
Significance of actively participating in middle school robot competition
云呐|固定资产盘点中,支持多种盘点方式(资产清查盘点)
Fabric 1.0源代码分析(33) Peer #peer channel命令及子命令实现
论坛系统数据库设计
激活函数之relu函数
The way to change children's programming structure
Optimize connections using connection groups (IM 6)
How to expand the capacity of the server in the 100 million level traffic architecture? Well written!
MQ在laravel中简单使用
Laravel绑定钉钉群警报(php)
https://www.nowcoder.com/exam/oj?tab=SQL%E7%AF%87&topicId=199&fromPut=pc_zh_n_you_sql