-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjects.sql
More file actions
72 lines (43 loc) · 1.53 KB
/
Projects.sql
File metadata and controls
72 lines (43 loc) · 1.53 KB
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
use student;
desc images;
alter table images add column name varchar(20),
add column description varchar (1000) ;
select * from images;
-- UPDATE images
-- SET name = "Palkhi ", description = "Palkhi Bro Lol"
-- WHERE id = 3;
-- delete from images where project_id = 4;
-- delete from donation where project_id =4;
truncate images;
-- INSERT INTO images (id, pic , name, description) VALUES (4, LOAD_FILE('C:/Users/Rashmit Mhatre/OneDrive/Desktop/WebD/MRunali/Cry Cutiee 2.jpg'), 'Random Shit', 'This is just for trial purpose');
alter table images
add column start_date date , add column end_date date ;
alter table images
add column raised_amount int , add column target int ;
alter table images modify raised_amount int not null;
-- UPDATE images
-- SET raised_amount = 0
-- WHERE id IN (1, 3, 4);
-- UPDATE images
-- SET target = 1000
-- WHERE id IN (1, 3, 4);
-- Step 2: Add the NOT NULL constraint
ALTER TABLE images
MODIFY raised_amount int NOT NULL default 0;
UPDATE images SET start_date = current_date(), end_date = current_date() WHERE project_id = 1;--
ALTER TABLE images
CHANGE COLUMN id project_id INT;
ALTER TABLE images
MODIFY COLUMN project_id INT AUTO_INCREMENT ;
ALTER TABLE images
MODIFY name varchar(255);
desc donation;
ALTER TABLE donation
DROP FOREIGN KEY donation_ibfk_2;
ALTER TABLE donation
DROP FOREIGN KEY fk_image;
ALTER TABLE donation
ADD CONSTRAINT fk_image
FOREIGN KEY (project_id) REFERENCES images (project_id);
delete from images where project_id = 10;
ALTER TABLE images MODIFY COLUMN pic LONGBLOB;