Skip to content

Instantly share code, notes, and snippets.

@abarth500
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abarth500/a7620b007dd759b636ad to your computer and use it in GitHub Desktop.
Save abarth500/a7620b007dd759b636ad to your computer and use it in GitHub Desktop.
[データベースシステム論] 第6回 SQL例文
--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