Last active
April 3, 2016 12:58
-
-
Save snsnsjsn/8d5e919b05343c90a88a to your computer and use it in GitHub Desktop.
gist test code
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
-- 数据库系统概念(原书第六版)——原整版带书签 | |
-- mysql 服务器支持 # 到该行结束、-- 到该行结束 以及 /* 行中间或多个行 */ 的注释方格 | |
create table `teaches`( | |
ID varchar(5), | |
course_id varchar(8), | |
sec_id varchar(8), | |
semester varchar(6), | |
year numeric(4,0), | |
primary key (ID,course_id,sec_id,semester,year), | |
foreign key (course_id,sec_id,semester,year) references section, | |
foreign key (ID) references instructor /*这里最后不能有逗号*/ | |
); |
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
//https://www.khanacademy.org/computing/computer-programming/sql/sql-basics/p/creating-a-table-and-inserting-data# | |
CREATE TABLE groceries (id INTEGER PRIMARY KEY, name TEXT, quantity INTEGER ); | |
INSERT INTO groceries VALUES (1, "Bananas", 4); | |
INSERT INTO groceries VALUES (2, "Peanut Butter", 1); | |
INSERT INTO groceries VALUES (3, "Dark chocolate bars", 2); | |
SELECT * FROM groceries; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment