HackerRank SQL

Employee Names

Problem:

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

Input Format

The Employee table containing employee data for a company is described as follows:

where employee_id is an employee’s ID number, name is their name, months is the total number of months they’ve been working for the company, and salary is their monthly salary.

Sample Input

Sample Output

Angela
Bonnie
Frank
Joe
Kimberly
Lisa
Michael
Patrick
Rose
Todd

Logic:

the syntax for “ALPHABETICAL ORDER” is ORDER BY NAME;

Solution:

SELECT NAME FROM EMPLOYEE ORDER BY NAME;

Link

--

--

--

My homepage to record my thought processes for solving SQL and Algorithm questions

Recommended from Medium

17 High Frequency Dart Code Snippets in 2020

CICD your Tableau Dashboard with Github Actions

Android App bundle(.aab)

Oraichain Studio — Live Demo Transcript

What is the «Green Screen of Death» in Windows 10?

Kanaria NFT Price Estimation

Automate your to-do list with Python

Quick guide to Android localization with Localazy

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Isabelle

Isabelle

In love with telling stories with data

More from Medium

SQL Introduction 1

An internal hard drive

INTRODUCTION TO SQL

SQL COMMANDS AND NORMALIZATION

Master SQL Queries (in 5 minutes)