What is SQL, and why should I care; or, An exercise in herding cats

A Brief History

Why should I care?

Photo by ETA+ on Unsplash

Digging a little deeper

Holes(2003)

1. Data Definition Language (DDL)

CREATE — — — — — Create a table or database

ALTER — — — — — — Modify values in tables

DROP — — — — — — Delete a table from a database

2. Data Manipulation Language (DML)

INSERT — — — — — Insert new rows in a table

UPDATE — — — — — Update values of existing rows in a table

DELETE — — — — — Delete a row or entire table

3. Data Control Language (DCL)

GRANT — — — — — Provide easy access to users

REVOKE — — — — Take back access privileges from users

4. Transaction Control Language (TCL)

COMMIT — — — — Deploy/apply /save changes in the database

ROLLBACK — — — Cancel/undo changes made in the database

SAVEPOINT — — — Temporarily save data in the database

5. Data Query Language (DQL)

SELECT — — — — — Fetch data from tables/database

Please help me find Kitty

Step 1: Create kitty table

CREATE TABLE Cats (
id INTEGER PRIMARY KEY,
name TEXT,
color TEXT,
neighborhood TEXT,
birthday INTEGER
);

Step 2: Add Kitty

INSERT INTO cats (name, color, neighborhood, birthday) VALUES 
('Kitty', 'white', 'London suburbs', 1101);

Step 3: Look at our data!

SELECT * FROM cats;

Step 4: Cats named Kitty!

SELECT * FROM cats WHERE name = "Kitty";

Step 4: AND

SELECT * FROM cats WHERE name = "Kitty" 
AND color = "white";

Step 5: ORDER BY

SELECT * FROM cats WHERE name = "Kitty"
AND color = "white"
ORDER BY birthday DESC;
Sanrio

In summary

--

--

--

Software Engineer and Librarian

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Integrating MISP into an malware analysis and collaboration CI/CD pipeline.

How to be a rockstar developer in 3 months

Excel add every nth column in a bookkeeping context.

Common Selenium C# Exceptions and Fixes

Systems Integration — The Power of APIs

Getting started with Azure and VMs

final screen in the sign up

LC 169 [Easy]: Majority Element

Sql Page Life Expectancy Is Critical Thinking

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
Amelia Elton

Amelia Elton

Software Engineer and Librarian

More from Medium

SQL Revamp Journey Week 3

Northwind Database Schema Diagram

LeetCode SQL| 184. Department Highest Salary

What is SQL?

Which DDL operation to choose?