-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchattingQuery.sql
More file actions
71 lines (51 loc) · 1.76 KB
/
chattingQuery.sql
File metadata and controls
71 lines (51 loc) · 1.76 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
71
create table Member(
id varchar(50) not null primary key,
password varchar(50) not null,
name varchar(50) not null,
registDate date);
insert into member values('master', '1234', '이승준', sysdate());
commit
alter table member add column unreadrequest int(3)
alter table member add column unreadmessage int(3)
alter table member add column unreadfriends int(3)
create table requestFriend(
requestNum int(5) not null auto_increment primary key,
fromId varchar(50) not null,
toId varchar(50) not null,
requestDate datetime not null)
alter table requestFriend modify requestDate datetime
create table friendsfriends(
id varchar(50) not null,
myFriendsId varchar(50) not null,
roomnum int(5) not null default -1,
myFriendName varchar(100) not null)
create table chattingrooms(
roomnum int(5) not null,
id varchar(50) not null,
unreadMessageCount int(3) default 0
)
drop table chattingrooms
create table roomnumseq(
roomnum int(5) not null auto_increment primary key
)
drop table roomnumseq
create table messages(
roomNum int(5) not null,
id varchar(50) not null,
name varchar(50) not null,
message text,
sendDate datetime not null,
unreadPeople text
)
commit
alter table messages drop unreadPopleCount
alter table messages add column unreadPeople text
alter table friends add column myFriendName varchar(100) not null
- ALTER TABLE messages CHANGE unreadPople unreadPeople text
alter table chattingrooms add column unreadMessage int(3) default 0
SET SQL_SAFE_UPDATES=0;
delete from friends
drop table chattingrooms
select e.name from member e, (select id from chattingrooms where roomnum = 38 and id != 'master') a where e.id = a.id
delete from requestFriend
alter table friends add column roomnum int(6) not null