-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathAlphaSchema.sql
More file actions
149 lines (117 loc) · 3.52 KB
/
AlphaSchema.sql
File metadata and controls
149 lines (117 loc) · 3.52 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
create database DBProject
go
use DBProject
create table UserLogin(
userID int ,
pass nvarchar(8) not null default '12345678',
primary key (userID,pass)
)
--drop table UserLogin
create table Admin_Students(
stdID int identity unique,
[Name] nvarchar(20) unique ,
CNIC nvarchar(19) unique,
primary key(stdID,[Name])
)
create table Admin_Teachers(
teacherId int identity unique,
[Name] nvarchar(20) unique,
courseId nvarchar(20) unique,
CNIC nvarchar(19) unique,
primary key (teacherId, [Name])
)
create table Discipline (
disId int primary key,
name nvarchar(25),
)
go
create table student(
stdId int unique foreign key references Admin_Students(stdID),
[Name] nvarchar(20)unique foreign key references Admin_Students([Name]),
fatherName nvarchar(25) not null,
cnic nvarchar(19) foreign key references Admin_Students(CNIC),
dob nvarchar(10) not null,--
discipline int foreign key references Discipline(disId),
gender char not null,--
mobile nvarchar(12) check ( mobile like '03__-%') ,--
city nvarchar(10),--
password nvarchar(20) not null,--
primary key (stdId, [Name])
)
--alter table student
--alter column dob nvarchar (10)
create table Teacher(
teacherId int unique foreign key references Admin_Teachers(teacherId),
[Name] nvarchar(20) unique foreign key references Admin_Teachers([Name]),
fatherName nvarchar(25) not null,
courseId int foreign key references Course(courseId),
cnic nvarchar(19) foreign key references Admin_Teachers(CNIC),
dob date not null,
discipline int foreign key references Discipline(disId),
gender char not null,
mobile nvarchar(12) ,
city nvarchar(10),
password nvarchar(20) not null,
email nvarchar(25),
primary key(teacherId)
)
--alter table teacher
--alter column dob nvarchar(10)
create table Course(
courseId int primary key,
name nvarchar(40) unique,
creditHours int,
discipline1 nvarchar(20),
discipline2 nvarchar(20),
discipline3 nvarchar(20),
)
create table Attandence(
courseId int foreign key references Course(courseId),
studentID int foreign key references student(stdId),
statuss char(1) check (statuss='A' or statuss='P'),
[day] int ,
[week] int,
)
create table Marks(
courseId int foreign key references course(courseId),
studentID int foreign key references student(stdId),
quiz int,
assignment int,
sessional1 int,
sessional2 int,
finalExam int,
absolute float,
discipline int,
weightage float,
totalmarks int,
dateconducted date
)
CREATE table GrandTotalTable(
courseId int foreign key references course(courseId),
studentID int foreign key references student(stdId),
finalmarks float,
finalgrade char(2)
primary key(studentID,courseId)
)
create table MonetaryDetails(
studentID int foreign key references student(stdId),
Name nvarchar(20) foreign key references student([Name]),
AmountPayable int not null,
DueDate date not null,
credithourrate int
)
create table LostAndFound(
OwnerID int,
ArticleId int identity primary key,
ArticleName nvarchar(25) not null,
Location nvarchar(30) not null,
status char check ( status = 'L' or status = 'F'),
Foreign key (OwnerID) references student(stdId),
Foreign key (OwnerID) references Teacher(teacherId),
)
create table TaskManager(
AssignmentId int primary key,
courseId int foreign key references course(courseId),
DueDate date not null,
Description nvarchar(1000)
)