Course source code: https://codistwa.com/guides/data-manipulation-select-distinct-insert-order-by-where. More courses on https://codistwa.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ============================================================ | |
-- 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