generated from UMKC-CS451R/SEGroup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sql_codes.sql
65 lines (54 loc) · 1.46 KB
/
sql_codes.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
CREATE DATABASE COMMERCE;
USE COMMERCE;
CREATE TABLE Login(
User_ID VARCHAR(15) NOT NULL,
User_name VARCHAR(50),
User_password VARCHAR(50),
PRIMARY KEY (User_ID));
CREATE TABLE Customer(
Account_Number VARCHAR(15) NOT NULL,
User_id VARCHAR(15) NOT NULL,
First_Name VARCHAR(50),
Last_Name VARCHAR(50),
Date_of_birth DATE,
Gender CHAR(1),
Address VARCHAR(255),
Email VARCHAR(70),
Phone_number VARCHAR(10),
SSN CHAR(9),
PRIMARY KEY (Account_Number, User_id),
CONSTRAINT u_customer UNIQUE (User_id, Account_Number, SSN),
CONSTRAINT fK_id FOREIGN KEY (User_id)
REFERENCES Login(User_ID)
ON DELETE CASCADE
ON UPDATE CASCADE
);
CREATE TABLE Account(
Account_Num VARCHAR(15),
Account_type VARCHAR(55),
Creation_date DATETIME,
PRIMARY KEY (Account_Num),
);
CREATE TABLE Notification(
Notification_ID VARCHAR(15) NOT NULL,
Acc_number VARCHAR(15),
Notification_Message VARCHAR(50),
PRIMARY KEY (Notification_ID)
);
CREATE TABLE Trigger_(
Trigger_ID VARCHAR(15),
Trigger_description VARCHAR(50)
PRIMARY KEY (Trigger_ID)
);
CREATE TABLE Transaction_(
Transaction_ID VARCHAR(15) NOT NULL,
Account_No VARCHAR(15),
Transaction_type VARCHAR(10),
Amount FLOAT,
Balance FLOAT,
Processing_Date DATETIME,
Description VARCHAR(100),
Location VARCHAR(60),
PRIMARY KEY (Transaction_ID),
);
/*CHANGES MADE: there is no attributes with datatype INT: ALL that was INT has been changed to VARCHAR(15) */