Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snsnsjsn/8d5e919b05343c90a88a to your computer and use it in GitHub Desktop.
Save snsnsjsn/8d5e919b05343c90a88a to your computer and use it in GitHub Desktop.
gist test code
-- 数据库系统概念(原书第六版)——原整版带书签
-- 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 /*这里最后不能有逗号*/
);
//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