-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsql_statements.sql
74 lines (52 loc) · 1.6 KB
/
sql_statements.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
create table collaborators ( user_id int, project_id int, start_date date, end_date date, primary key(user_id, project_id), foreign key (user_id) references user(id), foreign key (project_id) references project(id) );
create table skill ( owner int, name varchar(255), level varchar(255), PRIMARY KEY (name), FOREIGN KEY (owner) REFERENCES user(id) )
create table user(id INT NOT NULL AUTO_INCREMENT, username varchar(255) NOT NULL, firstname varchar(255), lastname varchar(255), city varchar(255), country varchar(255), avatar varchar(255), PRIMARY KEY (id) );
alter table user modify username varchar(255) UNIQUE NOT NULL;
alter table user modify password char(40) NOT NULL;
alter table project add column category_id varchar(255);
alter table project add FOREIGN KEY (category_id) REFERENCES category(id);
use sjodinj2;
drop table project;
drop table images;
drop table collaborators;
drop table project;
create table project (
id int not null auto_increment,
owner int not null references user(id),
name varchar(255),
description text(65535),
logo varchar(255),
startdate date,
enddate date,
status varchar(255),
primary key (id)
);
show columns in project;
create table images(
project_id int not Null,
foreign key (project_id) references project(id),
path varchar(255),
primary key(project_id, path)
);
show columns in images;
show tables;
insert into project values(
0,
1,
'bobs great project',
'insert html here',
'http://www.images.com',
'20140131',
NULL,
'ongoing'
);
select * from project;
insert into collaborators values(
1,
1,
'20140131',
NULL
);
select * from collaborators;
Images.com
www.images.com