Created
January 31, 2020 15:44
-
-
Save debonx/439f4d32f7542d7d0f18b7d101aad3be to your computer and use it in GitHub Desktop.
SQL: Create, insert, Alter, Update, Delete and Select.
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
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