Question

In: Computer Science

I have these following tables: �Company(compid, compname, comptype) �Job(jobid, jobtitle, salarylow, salaryhigh, location, compid*) �Skills(skillid, skillname)...

I have these following tables:

�Company(compid, compname, comptype)

�Job(jobid, jobtitle, salarylow, salaryhigh, location, compid*)

�Skills(skillid, skillname) �Jobskills(jobid*, skillid*, expertiseneeded)

�Applicant(appid, name, age, highdegree, expected_salary)

�AppSkills(appid*, skillid*, expertise)

�Applies(jobid*, appid*, appdate, decisiondate, outcome)

The queries are:

1. Find the outcome of all job applications of Monica (once again, note that there may be multiple Monica's in the database).

2. Find the applicants who have applied to more than 2 different companies.

3. Find the jobs that require no skills (well, as far as the data is concerned), i.e., jobs for which there is no corresponding skill listed in the database. Do this query without using a subquery.

4. Find the jobs located in Dayton that require both database and analysis skills.

5. Find the company offering the maximum salary in Chicago.

Solutions

Expert Solution

Short Summary:

  • Within the alloted time, was able to create the tables and shown you queries
  • Could not get time to insert records and shown you the sample outupt.

**************Please upvote the answer and appreciate our time.************

CREATE DATABASE JobSearch
GO

USE JobSearch
GO

CREATE TABLE Company(
   compid INT PRIMARY KEY IDENTITY(1,1)
   , compname VARCHAR(50)
   , comptype VARCHAR(50))

CREATE TABLE Job(
   jobid INT PRIMARY KEY IDENTITY(1,1)
   , jobtitle VARCHAR(50)
   , salarylow DECIMAL(18, 2)
   , salaryhigh DECIMAL(18, 2)
   , [location] VARCHAR(50)
   , compid INT
   , FOREIGN KEY(compid) REFERENCES Company(compid))

CREATE TABLE Skills(
   skillid INT PRIMARY KEY IDENTITY(1,1)
   , skillname VARCHAR(50))

CREATE TABLE Jobskills(
   jobid INT
   , skillid INT
   , expertiseneeded INT
   , PRIMARY KEY(jobid, skillid)
   , FOREIGN KEY(jobid) REFERENCES Job(jobid)
   , FOREIGN KEY(skillid) REFERENCES Skills(skillid))

CREATE TABLE Applicant(
   appid INT PRIMARY KEY IDENTITY(1,1)
   , [name] VARCHAR(50)
   , age INT
   , highdegree VARCHAR(50)
   , expected_salary DECIMAL(18, 2))

CREATE TABLE AppSkills(
   appid INT
   , skillid INT
   , expertise INT
   , PRIMARY KEY(appid, skillid)
   , FOREIGN KEY(appid) REFERENCES Applicant(appid)
   , FOREIGN KEY(skillid) REFERENCES Skills(skillid))


CREATE TABLE Applies(
   jobid INT
   , appid INT
   , appdate DATETIME
   , decisiondate DATETIME
   , outcome VARCHAR(50)
   , PRIMARY KEY(jobId, appid)
   , FOREIGN KEY(appid) REFERENCES Applicant(appid)
   , FOREIGN KEY(jobid) REFERENCES Job(jobid))


--1. Find the outcome of all job applications of Monica (once again, note that there may be multiple Monica's in the database).
SELECT jobid, outcome
FROM Applies
INNER JOIN Applicant ON Applicant.appid = Applies.appid
WHERE Applicant.[name] = 'Monica'

--2. Find the applicants who have applied to more than 2 different companies.
SELECT [name]
FROM Applicant
INNER JOIN Applies ON Applicant.appid = Applies.appid
INNER JOIN Job ON Job.jobid = Applies.jobid
GROUP BY Applicant.appid, Applicant.name
HAVING COUNT(DISTINCT Job.compid) >= 2


--3. Find the jobs that require no skills (well, as far as the data is concerned),
--i.e., jobs for which there is no corresponding skill listed in the database. Do this query without using a subquery.

SELECT jobid
FROM Job
EXCEPT
SELECT DISTINCT jobid
FROM Jobskills

--4. Find the jobs located in Dayton that require both database and analysis skills.
SELECT *
FROM Job
INNER JOIN Jobskills ON Jobskills.jobid = Job.jobid
INNER JOIN Skills ON Skills.skillid = Jobskills.skillid
WHERE Job.[location] = 'Dayton' AND Skills.skillname = 'database' AND Skills.skillname = 'analysis'


--5. Find the company offering the maximum salary in Chicago.
SELECT *
FROM Company
INNER JOIN Job On Job.compid = Company.compid
WHERE Job.[location] = 'Chicago' AND Job.salaryhigh = (SELECT MAX(Job.salaryhigh) FROM Job WHERE Job.[location] = 'Chicago')

**************************************************************************************

Feel free to rate the answer and comment your questions, if you have any.

Please upvote the answer and appreciate our time.

Happy Studying!!!

**************************************************************************************


Related Solutions

Tik Tok Company manufactures customized coffee tables. The following relates to Job No. X10, an order...
Tik Tok Company manufactures customized coffee tables. The following relates to Job No. X10, an order for 150 coffee tables: Direct materials used $22 800 Direct labour hours worked 600 Direct labour rate per hour $16.00 Machine hours used 400 Applied factory overhead rate per machine hour $30.00 a) What is the total manufacturing cost for Job No. X10? b) Calculate the cost per coffee table for Job No. X10? c) List two uses of this unit cost information to...
I have 3 tables, but I need that when the user logs in and enters his...
I have 3 tables, but I need that when the user logs in and enters his login and password, it shows me only the information of that client. But it is showing me the information of all the clients. Bank(mid,code,cid,sid,type,amount,mydate,note) from CPS300 This is the table where I want the information of a client to be seen Customers(id,name,login,password) from CPS200 Sources(id,name) from CPS200 --------------------------------------------------------------------------------------------------------------------------------- for now I have two queries, but I must correct the one for client authentication because...
SQL- Trigger I have two tables (below) I need to write a trigger that would delete...
SQL- Trigger I have two tables (below) I need to write a trigger that would delete everything for a pid from the Appt table if the pid is deleted from the patient table. Create table Appt(                 pid numeric Foreign Key references patient(pid),                 ptname varchar(50) Foreign Key references patient(name),                 dob date Foreign Key references patient(dob),                 dr varchar(20),                 appdate date,                 apptime time, ); and Create table Patient(                 pid numeric primary key,                 name varchar(50),                ...
Suppose a rehabilitation psychologist has developed a new job skills training program for people who have...
Suppose a rehabilitation psychologist has developed a new job skills training program for people who have not been able to hold a job. Of the 14 people who agree to be in the study, the researcher randomly picks seven of these volunteers to be in a experimental group who will go through the special training program. The other seven volunteers are put in a control group who will go through an ordinary job skills training program. After finishing the training...
Suppose a rehabilitation psychologist has developed a new job skills training program for people who have...
Suppose a rehabilitation psychologist has developed a new job skills training program for people who have not been able to hold a job. Of the 14 people who agree to be in the study, the researcher randomly picks seven of these volunteers to be in a experimental group who will go through the special training program. The other seven volunteers are put in a control group who will go through an ordinary job skills training program. After finishing the training...
Link the following two tables: HumanResources.Employee and Sales.SalesPerson then display Employee PK, job title, Date of...
Link the following two tables: HumanResources.Employee and Sales.SalesPerson then display Employee PK, job title, Date of birth, Gender, Sales quotas, Commission percent and bonus. Use an outer join to display all the employee whether they are in sales or not. Make sure to sort by bonus desc. Explain why some of the field from the Sales.SalesPerson table are null.
I have tables student, professor, and person. The relationship between student and person, and professor and...
I have tables student, professor, and person. The relationship between student and person, and professor and person is Is A inheritance. A person may be a student but not a professor, a professor but not a student, or neither a professor or a student. How do I write a trigger in SQL that forces the constraint that a person cannot be a student and a professor. Some extra info: I have defined ID to be PK of person. ID is...
please provide me below just i want z tables , t tables , chi square tables...
please provide me below just i want z tables , t tables , chi square tables both right tailed ,left tailed .,two tailed high quality of images only,other wise it wont help me, it leads thumbdown. thankyou chegg
How can i assess my skills and develop a plan to improve the skills to be...
How can i assess my skills and develop a plan to improve the skills to be successful in the financial services industry?
Job postings often state that the successful applicant must have superior critical thinking and problem-solving skills....
Job postings often state that the successful applicant must have superior critical thinking and problem-solving skills. Yet employers tell college administrators that graduates, both from undergraduate and graduate programs, often lack these skills. Having read this week's assigned materials, how would you define critical thinking? Why are employers making these comments? Are they justified? Your response should be at least 250 words.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT