Skip to content

Instantly share code, notes, and snippets.

@debonx
Created January 31, 2020 15:44
Show Gist options
  • Save debonx/439f4d32f7542d7d0f18b7d101aad3be to your computer and use it in GitHub Desktop.
Save debonx/439f4d32f7542d7d0f18b7d101aad3be to your computer and use it in GitHub Desktop.
SQL: Create, insert, Alter, Update, Delete and Select.
CREATE TABLE friends (
id INTEGER,
name TEXT,
birthday DATE
);
INSERT INTO friends (id, name, birthday)
VALUES
(1, 'Jane Doe', '1990-05-30'),
(2, 'Richard Stallman', '1953-03-16'),
(3, 'Enzo Carella', '1952-01-08');
UPDATE friends
SET name = 'Jane Smith'
WHERE id = 1;
ALTER TABLE friends
ADD COLUMN email TEXT;
UPDATE friends
SET email = '[email protected]'
WHERE id = 1;
UPDATE friends
SET email = '[email protected]'
WHERE id = 2;
UPDATE friends
SET email = '[email protected]'
WHERE id = 3;
DELETE FROM friends
WHERE id = 1;
SELECT * FROM friends;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment