当前位置:网站首页>SQL 入门计划-1-选择
SQL 入门计划-1-选择
2022-07-01 18:46:00 【南楚巫妖】
从这里开始,将学习如何掌握Leetcode中的SQL题目,每道题目都会有原本和变式两套版本,巩固学习,在实践中提高我的能力。
1 选择
原始版本:

因此,该题目的解答应该如下所示:
第一步:
新建数据库
第二步,
创建数据表:
CREATE TABLE world(
name INT NOT NULL AUTO_INCREMENT,
continent VARCHAR(100) ,
area INT NOT NULL ,
population INT NOT NULL ,
gdp INT NOT NULL ,
PRIMARY KEY (name)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
在这里,SQL 中主键name的数值类型和真实数值类型不一致。
插入相关数据

INSERT INTO world
(name, continent, area, population, gdp)
VALUES
(1, "a", 3000000,25000000,10);
INSERT INTO world
(name, continent, area, population, gdp)
VALUES
(2, "a", 1000000,15000000,10);
INSERT INTO world
(name, continent, area, population, gdp)
VALUES
(3, "a", 4000000,45000000,10);
INSERT INTO world
(name, continent, area, population, gdp)
VALUES
(4, "a", 5000000,65000000,10);
INSERT INTO world
(name, continent, area, population, gdp)
VALUES
(5, "a", 1000000,5000000,10);
INSERT INTO world
(name, continent, area, population, gdp)
VALUES
(6, "a", 1000000,25000000,10);
INSERT INTO world
(name, continent, area, population, gdp)
VALUES
(7, "a", 13000000,14000000,10);
写查询SQL的语句,得到反馈结果。
查询结果
这道题合适于,查询某两个字段大于/小于/等于某个数值的表。
比如我可以建立某个表,查询该表中某个数值过大的情况。
边栏推荐
- Opencv video quality detection -- sharpness detection
- sql查询去重统计的方法总结
- 解决VSCode下载慢或下载失败的问题
- Shell advanced
- Les canaux de culture intensive s'efforcent de développer Fu Xin et Wei Shi jiajie pour organiser une conférence de formation sur les nouveaux produits
- optaplanner学习笔记(一)案例Cloud balance
- 采集抖音视频
- 对象的创建
- Parallelism, concurrency and life cycle of threads
- 新增订单如何防止重复提交
猜你喜欢

Task: denial of service DOS

MySQl的基本使用

【AI服务器搭建】CUDA环境

Crunch简介、安装,使用Crunch制作密码字典

Oracle物理体系结构

Axure does not display catalogs
![[go ~ 0 to 1] day 5 July 1 type alias, custom type, interface, package and initialization function](/img/1e/bed6a761f07c052e43b1e3b1701760.png)
[go ~ 0 to 1] day 5 July 1 type alias, custom type, interface, package and initialization function

118. Yanghui triangle

ddr4测试-2

Native JS creates a calendar - supports mouse wheel scrolling to select months - and can be ported to any framework
随机推荐
音频编解码基础知识
Native JS creates a calendar - supports mouse wheel scrolling to select months - and can be ported to any framework
Ffmpeg avframe to cv:: mat
Simplified pinduoduo product data
2022/5/23-2022/5/30
Mysql查询结果去除换行
DTD modeling
sql查询去重统计的方法总结
Salesmartly has some tricks for Facebook chat!
一文读懂C语言中的结构体
求各种极限的方法
精耕渠道共谋发展 福昕携手伟仕佳杰开展新产品培训大会
Ffmpeg audio related commands
Werewolf killing strategy: do you think I'm easy to cheat? Who do we believe!
【sql优化】with as 和 临时表的区别
原生js打造日程表-支持鼠标滚轮滚动选择月份-可以移植到任何框架中
新窗口打开页面-window.open
EasyGBS网络不稳定情况下重复请求视频拉流问题的优化
类加载机制
1592 例题1 国王(Sgu223 LOJ10170 LUOGU1896 提高+/省选-) 暴力思考 状压DP 01背包