#CS403 Query
Create Database Bs140201235
use database Bs140201235
CREATE TABLE Role(
Role_id int not null PRIMARY KEY,
name varchar not null
);
CREATE TABLE Users(
User_id int not null PRIMARY KEY,
name varchar not null,
Role_id int FOREIGN KEY REFERENCES dbo.Role(Role_id)
);
Create Table Task(
Task_id nvarchar(50) not null PRIMARY KEY,
title varchar(max) not null,
creation_date date,
deadline date,
assigned_to varchar(max)
);
Create Table DiscussionThread(
Thread_id int not null PRIMARY KEY,
title varchar not null,
Task_id int FOREIGN KEY REFERENCES dbo.Task(Task_id)
);
create table Messages(
Msg_id int not null PRIMARY KEY,
message_body varchar not null,
sender_id varchar not null,
Thread_id int FOREIGN KEY REFERENCES dbo.DiscussionThread(Thread_id)
);
insert into dbo.Task (Task_id, title,creation_date,deadline,assigned_to) values ('T0001', 'Computer Science', '2019-01-01', '2019-01-15', '1');
insert into dbo.Task (Task_id, title,creation_date,deadline,assigned_to) values ('T0002', 'Management Science', '2019-02-02', '2019-02-16', '2');
insert into dbo.Task (Task_id, title,creation_date,deadline,assigned_to) values ('T0003', 'Mass Communication', '2019-03-03', '2019-03-17', '3');
insert into dbo.Task (Task_id, title,creation_date,deadline,assigned_to) values ('T0004', 'Bio Informatics', '2019-04-04','2019-04-20', '4');
insert into dbo.DiscussionThread(Thread_id, title) values ('Th001','BSCS');
insert into dbo.DiscussionThread(Thread_id, title) values ('Th002','BBA');
insert into dbo.DiscussionThread(Thread_id, title) values ('Th003','MSC zoology');
ALTER TABLE DiscussionThread
ADD Status varchar(max);
Comments
Post a Comment