Last active
August 29, 2015 14:09
-
-
Save abarth500/a7620b007dd759b636ad to your computer and use it in GitHub Desktop.
[データベースシステム論] 第6回 SQL例文
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
--p.14 | |
CREATE TABLE users ( | |
user_id integer, | |
namn varchar(30) NOT NULL, | |
PRIMARY KEY (user_id) | |
); | |
CREATE TABLE birthday ( | |
user_id integer, | |
barthday date NOT NULL, | |
FOREIGN KEY (user_id) | |
REFERENCES users(user_id) | |
); | |
--p.16 | |
ALTER TABLE birthday | |
RENAME COLUMN barthday TO birthday; | |
--p.18 | |
INSERT INTO users | |
VALUES(1,'Shohei Yokohama'); | |
INSERT INTO birthday | |
VALUES(1,'1977-10-31'); | |
--p.19 | |
INSERT INTO birthday | |
VALUES(5,'2014-11-11'); | |
--p.21 | |
UPDATE users | |
SET name = 'Shohei Yokoyama' | |
WHERE user_id = 1; | |
SELECT * FROM users; | |
--p.23 | |
DELETE FROM users | |
WHERE user_id = 1; | |
DELETE FROM birthday | |
WHERE user_id = 1; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment