-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSQLQuery1.sql
43 lines (36 loc) · 1.22 KB
/
SQLQuery1.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
--sql command to create table with foreign key
create table [dbo].[Vehicle](
[Id] int IDENTITY(1,1) NOT NULL,
[Name] nvarchar(max) NOT NULL,
[Model] nvarchar(max) NOT NULL,
[userId] nvarchar(128) NOT NULL,
primary key(Id),
FOREIGN KEY (userId) REFERENCES AspNetUsers(Id)
);
create table [dbo].[Booking] (
[booking_id] int IDENTITY(1,1) NOT NULL,
[date] nvarchar(max) NOT NULL,
[time] nvarchar(max) NOT NULL,
[pickup_location] nvarchar(max) NOT NULL,
[dropoff_location] nvarchar(max) NOT NULL,
[isAccepted] nvarchar(max) NOT NULL,
primary key(booking_id),
);
create table [dbo].[CustomerBooking](
[customer_booking_id] int IDENTITY(1,1) NOT NULL,
[userId] nvarchar(128) NOT NULL,
[booking_id] int NOT NULL,
[vehicle_id] int NOT NULL,
primary key(customer_booking_id),
FOREIGN KEY (userId) REFERENCES AspNetUsers(Id),
FOREIGN KEY ([booking_id]) REFERENCES Booking(booking_id),
FOREIGN KEY (vehicle_id) REFERENCES Vehicle(Id)
);
Go
alter table aspnetroles add RoleDescription nvarchar(255) NULL;
select * from AspNetRoles;
-- insert statments
insert into AspNetRoles([Id], [Name], [RoleDescription])
values (2, 'Staff', 'Staff');
insert into AspNetRoles([Id], [Name], [RoleDescription])
values (3, 'Customer', 'Customer');