Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[データベースシステム論] 第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
You can’t perform that action at this time.