Question

In: Computer Science

For the group project, you will be creating a database system to solve a business problem...

For the group project, you will be creating a database system to solve a business problem of your choice. The database system must meet the criteria shown below. In addition to the database solution, each student will prepare a system summary.

Database System Requirements (Group Work):

  • Create a database and name it ITCO630_GPx where "x" is your group letter. Populate your database with appropriate test data.
  • Include all of the scripts in a single file called ITCO630_GPx.SQL where x is your group letter.
  • Create at least 3 related tables in the database.
  • Create at least 2 stored procedures and a script to use each of them.
  • Create at least 1 view (using a script).
  • Create at least 1 trigger.
  • Create at least 5 useful queries. At least one of these queries should use a subquery and at least 1 of the queries should use an aggregate function.
  • All scripts should be well-documented.

Solutions

Expert Solution

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

Business problem :

ResolveQ -The Ultimate Solution

ResolveQ is intended to be a Paid portal where a developer, whether novice or expert treated on an equal level. A place where questions related to information technology (IT) solved. If a user puts up a request and the admin ratifies it, then he can expect to get a solution simply because there are so many people out there and it is very likely that one of them may have faced the problem before and are willing to help.

A user may post a question request or submit an entire specification for a project. The facilities provided by the website will handle the request. The organisation handling the website employs the Admin and Experts. These are the backbone of the website and ensure its smooth functioning. Unlike other request-reply sites where nearly everything is dependent on voluntary contributions by users, here we have an efficient support structure in place.

An Admin processes all incoming requests or questions. He view the questions and their and there category or zone to classify them, and according assign an expert of the same zone. After his assignment, the assignment viewed by the expert and has to give the answer in specific time. On other hand registered user can also provide the answers to the questions.

This system contains below tables :

1.Questions

2.Answers

3.Expert

4.Category

Database Creation :

This demonstration is using SQL Server.

Database Name :ITCO630_GPx (Note : where "x" is your group letter change this)

SQL Query :

/*Creating database ITCO630_GPx */

create database ITCO630_GPx

Screen in SSMS (SQL Server Management Studio) :

CREATING TABLES :

1.Questions : This table is used to store the questions asked by user.

Table Structure :

Field

Field Name

Data Type

Width

Constraints

Discription

1

Qid

Int

Primary key

Question Id

2

Question

Text

Not Null

Question

3

CategoryId

Int

Foreign Key

Category

4

Time

Datetime

Not Null

Time of asking

5

Empuserid

Varchar

20

-

Expert assigned to give answer

SQL Script for creating table:

/*Table : Questions*/
create table Questions(
Qid int primary key Identity ,
Question Text not null,
CategoryId int foreign key references category ,
Time DateTime not null,
Empuserid varchar(20) references expert)

SQL script for inserting records :

/*Inserting records into Questions table*/
insert into Questions values('Database that is owned by Microsoft',1001,18/06/2018,'viratkohli')
insert into Questions values('Javascript is server side scripting language',1002,18/06/2018,'SachinTendulkar')
insert into Questions values('Visual Studio is an',1003,18/06/2018,'RohitSharma')

Fetching records from Questions Table :

/* Fetching records from Questions Table */
select * from Questions

Screen in SSMS :

2.Answers : This table is used to store the answers of each question

Field

Field Name

Data Type

Width

Constraints

Discription

1

Ansid

Int

Primary key

Answer ID

2

Text

Not Null

Answer body

3

Qid

Int

Foreign key

Related question

4

Views

Int

Not Null

Number of views

5

Empuserid

Varchar

20

Not Null

Employee id

SQL Script for creating table:

/*Table : Answers*/
create table answers (
AnsId int primary key Identity(501,1),
Answer Text not null,
Qid int foreign key references questions,
views int not null,
Empuserid varchar(20) not null)

SQL script for inserting records :

/* Inserting records into Answers */
insert into answers values('SQL Server',2,1,'viratkohli')
insert into answers values('False',3,2,'sachintendulkar')
insert into answers values('IDE',4,5,'RohitSharma')

Fetching records from Answer table :

/*Fetching records from Answer Table*/
select * from answers

Screen in SSMS :

3.Expert : This table is used to store the details of expert.

Field

Field Name

Data Type

Width

Constraints

Discription

1

Empuserid

Varchar

20

Primary key

Employee id

2

Password

Varchar

20

Not Null

Password of the employee

3

CategoryId

Int

Foreign key

Category Id

SQL Script for creating table:

/*Table : Expert */
create table Expert(
Empuserid varchar(20) primary key,
Password varchar(20) not null,
CategoryId int foreign key references category)

SQL script for inserting records :

/*Inserting records into Expert table*/
insert into Expert values('ViratKohli','virat@123',1001)
insert into Expert values('SachinTendulkar','sachin@123',1002)
insert into Expert values('RohitSharma','rohit@123',1003)
insert into Expert values('AjinkyaRahne','Ajinkya@123',1004)
insert into Expert values('HardikPandya','Hardik@123',1005)

Fetching Records from Expert Table:

/*Records from Expert Table*/
select * from Expert

Screen in SSMS :

4.Category : This table is used to store category of question.

Field

Field Name

Data Type

Width

Constraints

Discription

1

CategoryId

Int

Primary key

Category Id

2

Category

Varchar

50

Not Null

Category Name

3

Description

Text

-

Description

SQL Script for creating table:

/*Table : Category */
create table Category(
CategoryId int primary key Identity(1001,1),
Category varchar(50) not null,
Description Text not null
)

SQL script for inserting records :

/*Inserting records into Category table*/
insert into Category values('Database','This category contains questions related to all databases')
insert into Category values('Programming','This category contains questions related to all programming languages')
insert into Category values('Software','This category contains questions related to all Software')
insert into Category values('Hardware','This category contains questions related to all Hardware')
insert into Category values('Storage','This category contains questions related to storage devices')

Fetching records from Category table :

/*Records from Category Table*/
select * from Category

Screen in SSMS :

SQL Queries :

1. Selecting all questions along with answers

SQL Script :

select questions.Qid, Question , answer from questions , answers where questions.qid=answers.qid

Screen in SSMS :

2.select all the experts that belongs to each category

SQL Query :

/*select all the experts that belongs to each category */

select Empuserid , password , Category, Description from expert full outer join Category on
expert.CategoryId=Category.CategoryId

Screen in SSMS :

3. Counting all experts (using aggregate function)

SQL Script :

/*counting all experts*/
select count(Empuserid) as count , Empuserid from expert group by Empuserid

Screen in SSMS :

Creating View :

create view to get all the records from question table :

/* view */
create view getQuestions as (
select * from questions)

/*executing views*/

select * from getQuestions;

Screen in SSMS :

Stored procedure :

1. To get all categories

SQL Script :

/* stored procedure */
create procedure getAllCategories
as
begin
select * from Category;
end

Executing stored procedure :

exec getAllCategories;

Screen in SSMS :

2.to get all answers :

SQL Script :

/*Stored procedure to get all answers*/
create procedure getAllAnswers
as
begin
select * from answers;
end

Executing procedure :

/*executing stored procedure*/
exec getAllAnswers;

Screen in SSMS :

Trigger :

A trigger is a special type of stored procedure that automatically executes when an event occurs in the database server.

Kindly revert for any queries

Thanks.


Related Solutions

our company is creating the database for the sales system. These are the major components: Database...
our company is creating the database for the sales system. These are the major components: Database design User entry form design Report design Access and authentication Maintenance You are assigned as an IT manager. For this Discussion, gather information from the library and research other web resources. Write a plan describing your role in designing, developing, managing, and supporting the database.
Think about a DATABASE PROJECT (BUSINESS PROBLEM) you want to do after school show me the...
Think about a DATABASE PROJECT (BUSINESS PROBLEM) you want to do after school show me the attributes create a three table for it and explain each table and what it mean.
Assume you are creating a database for IS paint store. The database needs to support the...
Assume you are creating a database for IS paint store. The database needs to support the following business functions. • Allow customers to browse the inventory. Customers want to search by paint types and colors. Customers also wants to know pricing information. • A customer can be a regular customer (e.g., home owner), or a contractor or painting professionals. Different customers can get different discounts for the same type of paint. We assume each customer can get the same discount...
Creating a Database Design Lab 1: Creating a Database Design (Wk 3) - OR - Draw...
Creating a Database Design Lab 1: Creating a Database Design (Wk 3) - OR - Draw with pencil and paper diagram (take photo of it and submit) along with a summary of the diagram you prepared in a Word document. Use the scenario from Assignment 1: Business Rules and Data Models to complete the lab: Suppose a local college has tasked you to develop a database that will keep track of students and the courses that they have taken. In...
Project: Building a Relational Database Management System  This project is where you show off your...
Project: Building a Relational Database Management System  This project is where you show off your ability to (1) translate a business requirement into a database design, (2) design a database using one-to-many and many-to-many relationships, and (3) know when to use LEFT and/or RIGHT JOINs to build result sets for reporting. An organization grants key-card access to rooms based on groups that key-card holders belong to. You may assume that users below to only one group. Your job is...
Project Definition - Describe the type of problem you wish to address with a database: Let's...
Project Definition - Describe the type of problem you wish to address with a database: Let's say, an online video game or movie rental system. A. Describe the concern or problem you will try to address with a small database B. Provide examples of the current (possibly hypothetical) approach - include actual or mock-ups of relevant forms, reports, lists, etc. C. Discuss how your approach should eliminate Delete/Update/Insert problems and help manage this issue in the future. Any help will...
Normalizing the Relational Model for the Student Project and Creating a Normalized SQL Database Patient (patientNo,...
Normalizing the Relational Model for the Student Project and Creating a Normalized SQL Database Patient (patientNo, name, address, phone, dateOfBirth, sex, insuranceCo, policyNo, relationshipToInsured) Appointment(patientNo, apptdate, appttime, reason, staffNo, visitNo) Visit(visitNo, patientNo, visitdate, visittime, duration, reason, visitType, visitCost, staffNo, roomNo) Staff(staffNo, name, title, specialty, address, phone) Availability(staffNo, availDate, startTime, endTime) InsurancePolicy (company, policyNo, insuredName, policytype, medicalCoPay, labCoPay, pharmacyCoPay, startDate, endingDate) DiagnosisMenu(diagCode, diagName) ProcedureMenu(procCode, procName, cost) Room(roomNo, roomType, condition) PrescriptionScript(scriptNo, visitNo, dateWritten, itemPrescribed, quantityPrescribed, directions, numberRefills) LabTest(testNo, prescriptionNo, testype, testDate, testTime,...
Explain why a database and a database management system are fundamental to business operations. Short Essay...
Explain why a database and a database management system are fundamental to business operations. Short Essay Question
You are creating a Security Group for a group of mission-critical EC2 instances, and do not...
You are creating a Security Group for a group of mission-critical EC2 instances, and do not want to allow just anyone to be able to SSH into them. As such, you cannot allow traffic on port 22 from the open Internet. What best practice can you implement to still allow you and your colleagues to be able to establish an SSH connection with these instances, without allowing anyone with Internet access to do the same? Group of answer choices Deploy...
Project 3 Details The purpose of this project is to give you experience with creating and...
Project 3 Details The purpose of this project is to give you experience with creating and using custom objects. In it, you will make a couple custom classes that work in tandem with each other, and call them in your main function. For this project we'll be making something kind of like the Chatbot java file we made in class. You will create a Chatbot class that will contain a number of variables and functions. As you can imagine, a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT