Skip to content

Instantly share code, notes, and snippets.

@codistwa
Last active February 23, 2022 15:28
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
-- ============================================================
-- SELECT
-- ============================================================
SELECT *
FROM humanresources.employee;
SELECT jobtitle
FROM humanresources.employee;
SELECT jobtitle, gender
FROM humanresources.employee;
-- ============================================================
-- DISTINCT
-- ============================================================
SELECT DISTINCT jobtitle, gender
FROM humanresources.employee;
-- ============================================================
-- Sorting
-- ============================================================
SELECT DISTINCT jobtitle
FROM humanresources.employee ORDER BY jobtitle;
SELECT unitprice
FROM purchasing.purchaseorderdetail
ORDER BY unitprice DESC;
-- ============================================================
-- LIMIT
-- ============================================================
SELECT jobtitle
FROM humanresources.employee LIMIT 2;
SELECT jobtitle
FROM humanresources.employee LIMIT 10 OFFSET 5;
-- ============================================================
-- Alias
-- ============================================================
SELECT jobtitle
FROM humanresources.employee AS HR;
-- ============================================================
-- WHERE
-- ============================================================
SELECT jobtitle
FROM humanresources.employee where maritalstatus = 'S';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment