SQL Fundamental

https://macpostgresclient.com/
  • 1 Create a Postgres Table
  • 2 Insert Data with Insert
  • 3 Filter Data in a Postgres Table with Query Statements
  • 4 Update Data in Table with update
update Users set user_handle = uuid_generate_v4() where last_name = 'clark';
  • 5 Removing Data with Delete, Truncate and Drop
SELECT nameFROM customerWHERE referee_id != 2OR referee_id IS NULL
SELECT name CustomersFROM CustomersWHERE id NOT IN (SELECT customerId FROM Orders)
SELECT column_name(s)
FROM table_name
WHERE column_name IN (SELECT STATEMENT);

1699. Number of Calls Between Two Persons

SELECT 
from_id AS person1, to_id AS person2,
COUNT(1) AS call_count, SUM(duration) AS total_duration
FROM calls
GROUP BY LEAST(from_id, to_id), GREATEST(from_id, to_id)

--

--

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