当前位置:网站首页>SQL exercise (I)
SQL exercise (I)
2022-04-23 12:05:00 【Copy the wrong code】
Catalog
Query results limit the number of rows returned
Sort multiple columns after searching
Find the student information of the school is Peking University
Look for ages greater than 24 Users of
Find user information for a certain age group
Find user information except Fudan University
use where Filter null exercises
Study SQL It's been a while , Want to master it more skillfully , Then only brush the questions ~~~
Brush the question website : Cattle from - Looking for work artifact | Written examination question bank | The interview experience | Internship recruitment push , One stop job search _ Cattle from
https://www.nowcoder.com/exam/oj?tab=SQL%E7%AF%87&topicId=199&fromPut=pc_zh_n_you_sql
-
SQL Non technical quick start
-
Basic query
-
Query all columns

Code :select sentence
select * from user_profile
-
Query multiple columns

Code : From table select Out : equipment ID, Gender , Age school listing is OK
select device_id,gender,age,university -- equipment ID, Gender , Age school
from user_profile
-
Query result de duplication

Code :distinct duplicate removal
select distinct university
FROM user_profile
-
Query results limit the number of rows returned
Code :where Conditions of the query
select device_id
from user_profile
where id<=2
- Rename the queried column

Code :as rename , Rename and :
select device_id as user_infos_example
from user_profile
where id<=2
-
Conditions of the query
- Sort after finding

Code :order by Name asc/desc asc Ascending ,desc Descending , The default sort is Ascending
select device_id,age from user_profile order by age
-
Sort multiple columns after searching

Code :
select device_id, gpa, age from user_profile
order by gpa asc, age asc
- Sort in descending order after finding

Code :desc Descending order
select device_id,gpa,age
from user_profile
order by gpa desc,age desc
-
Find the student information of the school is Peking University

Code :where Statement condition query
select device_id,university
from user_profile
where university=' Peking University, '
-
Look for ages greater than 24 Users of

Code :
select device_id,gender,age,university
from user_profile
where age>24
-
Find user information for a certain age group

Code :and Parallel conditions
select device_id,gender,age
from user_profile
where age>=20 and age<=23
-
Find user information except Fudan University
Code :!= It's not equal to
select device_id, gender, age, university
from user_profile
where university != ' Fudan University '
-
use where Filter null exercises

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

版权声明
本文为[Copy the wrong code]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231156018883.html
边栏推荐
- Siri gave the most embarrassing social death moment of the year
- Fastjson 2 is coming, the performance continues to improve, and it can fight for another ten years
- 什么是网关
- 程序员如何用130行代码敲定核酸统计
- 论文解读(CGC)《CGC: Contrastive Graph Clustering for Community Detection and Tracking》
- Practical data Lake iceberg lesson 30 MySQL - > iceberg, time zone problems of different clients
- 第四章 为物化视图启用和禁用IM列存储(IM 4.6)
- 第五章 使用In-Memory表达式优化查询(IM 5.1)
- Nacos Foundation (9): Nacos configuration management from single architecture to microservices
- Symmetric encryption, certificate encryption
猜你喜欢

力扣-70.爬楼梯

Design and practice of the smallest short website system in the whole network

智能多线弹性云增加独立的IP地址,如何实现多线功能?

The database navigator uses the default MySQL connection prompt: the server time zone value 'Ö Ð¹ ú±ê ×¼ ʱ ¼ ä’ is unrecognized or repres

5分钟NLP:Text-To-Text Transfer Transformer (T5)统一的文本到文本任务模型

云呐|固定资产盘点中,支持多种盘点方式(资产清查盘点)

Nacos Foundation (9): Nacos configuration management from single architecture to microservices

Idea database navigator plug-in

九十八、freemarker框架报错 s.e.ErrorMvcAutoConfiguration$StaticView : Cannot render error page for request

激活函数之阶跃函数
随机推荐
Metalama简介4.使用Fabric操作项目或命名空间
How imeu is associated with imcu (IM 5.5)
ES6 learning notes II
5-minute NLP: text to text transfer transformer (T5) unified text to text task model
第四章 为IM 启用填充对象之强制填充In-Memory对象:教程(IM 4.7)
Link sorting of tutorials such as assembly language running environment setting
Summary of convolution layer and pooling layer
PSCP basic usage
【Redis 系列】redis 学习十三,Redis 常问简单面试题
PCB的注意事项
第二十四课 经典问题解析
云呐|固定资产盘点中,支持多种盘点方式(资产清查盘点)
Optimize connections using connection groups (IM 6)
Use kettle to copy records to and get records from results
ThinkPHP adds image text watermark to generate promotion poster with QR code
IDEA 代码质量规范插件SonarLint
golang之笔试题&面试题01
Here comes the detailed picture and text installation tutorial of H5 game
Tan Xiang, CEO of Kechuang · Pera software: the essence of zero trust is digital security. To B should also deeply study the user's mind
Symmetric encryption, certificate encryption
