-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGrantAwishSQL
More file actions
59 lines (46 loc) · 1.26 KB
/
GrantAwishSQL
File metadata and controls
59 lines (46 loc) · 1.26 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
use GrantAWish
select * from Wishes
go
create table [User](
userID bigint identity(1,1) primary key,
username nvarchar(250) not null unique,
password nvarchar(max) not null,
name nvarchar(50) not null,
signup_Date datetime2 not null,
contact_Number varchar(10) not null
)
go
create table [Admin](
adminID int identity(1,1) primary key,
name nvarchar(50) not null,
username nvarchar(250) not null,
password nvarchar(max) not null,
contact_Number varchar(10) not null,
addedby int references Admin(adminID)
)
go
create table Wishes
(
wishId int identity,
wisherName nvarchar(100) not null,
wisherGender varchar(6) default 'Male',
wishStatus int not null,
wish nvarchar(MAX) not null,
wishDate datetime2 not null,
wisherAge int not null
);
go
alter table Wishes
add addedBy int references Admin(adminID)
go
alter table Wishes
add grantedBy bigint references [User](userID)
go
Select * from Wishes
Select * from Admin
Select * from [User]
go
insert into Admin values('Harveen','harveen54@gmail.com','123456',9915123897,1)
insert into [user] values('harveen54@gmail.com','123456','harveen',GetDate(),9915123897)
insert into Wishes values('Harveen','Male',1,'New Clothes',GETDATE(),21,null,null)
update wishes set addedBy=1,grantedBy=1 where wishId=1