HackerRank第一趴–Basic Select

ID number NAME VARCHAR2(17) COUNTRYCODE VARCHAR2(3) DISTRICT VARCHAR2(20) POPULATION number

1. Revising the Select Query I

Query all columns for all American cities in the CITY table with populations larger than 100000. The CountryCode for America is USA.

2. Revising the Select Query II

Query the NAME field for all American cities in the CITY table with populations larger than 120000. The CountryCode for America is USA.

3.Select All

Query all columns (attributes) for every row in the CITY table.

4. Select By ID

Query all columns for a city in CITY with the ID 1661.

5.Japanese Cities’ Attribute

Query all attributes of every Japanese city in the CITY table. The COUNTRYCODE for Japan is JPN.

6.Japanese Cities’ Name

Query the names of all the Japanese cities in the CITY table. The COUNTRYCODE for Japan is JPN.

Query a count of the number of cities in CITY having a Population larger than 10,000.

9.Query the average population of all cities in CITY where District is California .

10.Query the average population for all cities in CITY , rounded down to the nearest integer.

11.Query the sum of the populations for all Japanese cities in CITY. The COUNTRYCODE for Japan is JPN.

12.Query the difference between the maximum and minimum populations in CITY.

13.Given the CITY and COUNTRY tables, query the sum of the populations of all cities where the CONTINENT is ‘Asia’.

Note: CITY.CountryCode and COUNTRY.Code are matching key columns.

14.Given the CITY and COUNTRY tables, query the names of all cities where the CONTINENT is ‘Africa’.

Note: CITY.CountryCode and COUNTRY.Code are matching key columns.

15.

ID INTEGER Name String Maks INTEGER

1.Query the Name of any student in STUDENTS who scored higher than Marks. Order your output by the last three characters of each name. If two or more students both have names ending in the same last three characters (i.e.: Bobby, Robby, etc.), secondary sort them by ascending ID.

查询 STUDENTS 中任何得分高于 75 的学生的姓名。 按每个名称的最后三个字符对输出进行排序。 如果两个或多个学生的名字都以相同的最后三个字符结尾(即:Bobby.Robby 等),则按 ID 升序对他们进行二次排序。

解题思路,按照每个名字的最后三个字符排序,order by 和right函数结合使用。

employee_id INTEGER name String months INTEGER salary INTEGER

1.Write a query that prints a list of employee names (i.e.: the name attribute) from the Employee table in alphabetical order.

2.Write a query that prints a list of employee names (i.e.: the name attribute) for employees in Employee having a salary greater than per month who have been employees for less than months. Sort your result by ascending employee_id.

编写一个查询,打印员工姓名列表(即:名称属性),用于 Employee 中薪水大于每月且工作时间少于几个月的员工。 按employee_id 升序对结果进行排序。

3.We define an employee’s total earnings to be their monthly salary*months worked, and the maximum total earnings to be the maximum total earnings for any employee in the Employee table. Write a query to find the maximum total earnings for all employees as well as the total number of employees who have maximum total earnings. Then print these values as 2 space-separated integers.

我们将员工的总收入定义为他们的月薪*工作月数,最大总收入定义为 Employee 表中任何员工的最大总收入。 编写查询以查找所有员工的最大总收入以及拥有最大总收入的员工总数。 然后将这些值打印为 2 个空格分隔的整数。

Original: https://www.cnblogs.com/ruoli-121288/p/16335207.html
Author: 徐若离
Title: HackerRank第一趴–Basic Select

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/620183/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

  • NO.2 Windows桌面图标-间距参数调整

    遇到如下问题: 桌面图标自动排序后间隔过大,且如图二这种指向图标能看到图标之间的间隔虚框,此方法可调整虚框的水平和垂直距离,即调整图标之间的间距。 测试电脑: 华为 mateboo…

    数据库 2023年6月14日
    0109
  • 工程师成长阶段感悟

    从 2013 年陆续开始做软件研发工作, 去过不少公司, 做过一些类型项目, 桌面开发, web 开发, 手游开发, 端游开发, 棋牌, 视频云服务, 电商. 刚毕业那会在国企, …

    数据库 2023年6月9日
    0106
  • English words 929 9:00

    本文来自博客园,作者:ukyo–BlackJesus,转载请注明原文链接:https://www.cnblogs.com/ukzq/p/16743070.html Or…

    数据库 2023年6月11日
    0101
  • Excel中VLOOKUP函数的用法

    一、VLOOKUP函数的作用 作用 :VLOOKUP函数可以帮助我们在已有的内容中快速匹配到我们想要的结果 二、VLOOKUP函数的参数及用法实例 VLOOKUP函数有四个参数:V…

    数据库 2023年6月11日
    084
  • Java学习-第一部分-第二阶段-项目实战:坦克大战【3】

    坦克大战【3】 笔记目录:(https://www.cnblogs.com/wenjie2000/p/16378441.html) 坦克大战0.6版 √增加功能 2. 记录玩家的成…

    数据库 2023年6月11日
    0107
  • WIN10下启动VMware虚拟机蓝屏的解决办法

    问题: 每次启动虚拟机就会蓝屏,提示错误代码: PAGE_FAULT_IN_NONPAGED_AREA 解决办法: 禁用 Hyper-V 功能 打开”控制面板&#821…

    数据库 2023年6月14日
    0101
  • Python 学习笔记(六)–线程

    1.自定义进程 自定义进程类,继承Process类,重写run方法(重写Process的run方法)。 from multiprocessing import Process im…

    数据库 2023年6月16日
    0129
  • 在Linux中使用crontab

    查看已存在的任务 查看crontab 输入命令: cat /etc/crontab 在设定编辑之前都建议列出服务查看一下: crontab -l 语法: **** user_nam…

    数据库 2023年6月14日
    097
  • Redisson

    ​ Redisson是架设在Redis基础上的一个Java驻内存数据网格(In-Memory Data Grid)。充分的利用了Redis键值数据库提供的一系列优势,基于Java实…

    数据库 2023年6月6日
    093
  • 网络通信知识地图

    知识地图是一种知识导航系统,并显示不同的知识存储之间重要的动态联系。本篇主要就是从更高的视角将之前的文章的结构思路展现出来。文章结构的思路实际上也是达到架构师程度要掌握的网络通信知…

    数据库 2023年6月6日
    0104
  • 最小堆、胜者树和败者树

    前言 本文介绍三种外部排序算法:最小堆、胜者树和败者树,以及为什么外部排序往往用败者树。 最小堆 最小堆有以下特点:1、最小堆是一颗完全二叉树2、每个父节点的值总是小于等于左右孩子…

    数据库 2023年6月9日
    098
  • jar工具常用命令

    参考链接:https://www.ibm.com/developerworks/cn/java/j-jar/index.html Original: https://www.cnb…

    数据库 2023年6月9日
    085
  • mysql数据库 Window下安装

    关系数据库,是建立在关系数据库模型基础上的数据库,借助于集合代数等概念和方法来处理数据 库中的数据,同时也是一个被组织成一组拥有正式描述性的表格,该形式的表格作用的实质是装载着数 …

    数据库 2023年6月9日
    0109
  • NO.1 通讯录管理系统+源代码(C++)

    功能描述:显示简单的菜单,供用户选择操作 实现步骤:直接cout输出 功能描述:根据用户不同的操作代码选择,进入不同的功能,我们使用switch分支结构进行搭建 实现步骤:用whi…

    数据库 2023年6月14日
    078
  • Redis学习笔记一

    ============================= Redis学习笔记一 注:笔记旨在记录 一、redis简介: 高性能的 key-value 数据库 特点: 支持数据持久…

    数据库 2023年6月16日
    078
  • Java面向对象程序设计(1)类与对象

    类与对象 类和对象的联系 类是抽象的,是由程序员对一种事物进行抽象而构造的一种数据类型 对象是具体的,它是类的一个实例化 类是对象的模板,对象是类中的一个个体 类和对象的内存分配机…

    数据库 2023年6月16日
    081
亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球