forked from lugatuic/MembershipDatabaseInitScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lugDBinit.sql
51 lines (44 loc) · 1.08 KB
/
lugDBinit.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
CREATE DATABASE LUGDB;
USE LUGDB;
CREATE TABLE memberType(
memTypeRef int,
memTypeName varchar(30)
);
CREATE TABLE Member(
lastName varchar(100),
fullLegalName varchar(200),
preferredName varchar(100),
netid varchar(9),
email tinytext,
UIN varchar(20),
joinDate date,
memStatus int,
beenActive bit,
wasOfficer bit
);
CREATE TABLE LUGDATA(
UIN varchar(20),
lugUserName varchar(20),
password varchar(20)
);
CREATE TABLE Events
(
eventName varchar(30),
eventID int,
EventDate datetime,
EventLocation varchar(20)
);
CREATE TABLE eventAttendance
(
eventID int,
attendeeID varchar(20)
);
INSERT INTO memberType(memTypeRef,memTypeName)
values(1,"Passive");
INSERT INTO memberType(memTypeRef,memTypeName)
values(2,"Active");
INSERT INTO memberType(memTypeRef,memTypeName)
values(3,"Alumni");
#ALTER TABLE `eventAttendance` ADD FOREIGN KEY (`attendedby`) REFERENCES `Member` (`UIN`);
#ALTER TABLE `eventAttendance` ADD FOREIGN KEY (`eventid`) REFERENCES `Events` (`eventid`);
#ALTER TABLE `Member` ADD FOREIGN KEY (`memStatus`) REFERENCES `memberType` (`memTypeRef`);