Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For the following SQL table, how could I go about writing a query that selects s

ID: 3917042 • Letter: F

Question

For the following SQL table, how could I go about writing a query that selects several entries based off of a particular attribute or set of attributes?

USE UNCLE_BOB_FIXIT
GO

INSERT INTO Job (Job_Status, Job_Hours, Job_Uniqueness, Job_Start_Date, Job_End_Date, Job_Material_Cost, Job_Labor_Cost, Job_Extra_Cost, Job_Total_Cost, Address_ID, Customer_ID)

VALUES ('B', 5.0, 'none', '2018-01-15', '2018-01-15', 86.25, 50.00, 0.00, 136.25, 1, 1);

INSERT INTO Job (Job_Status, Job_Hours, Job_Uniqueness, Job_Start_Date, Job_End_Date, Job_Material_Cost, Job_Labor_Cost, Job_Extra_Cost, Job_Total_Cost, Address_ID, Customer_ID)

VALUES ('A', 3.25, 'customer has a dog', '2018-07-20', '2018-07-21', 30.00, 32.50, 5.00, 67.50, 2, 2);

INSERT INTO Job (Job_Status, Job_Hours, Job_Uniqueness, Job_Start_Date, Job_End_Date, Job_Material_Cost, Job_Labor_Cost, Job_Extra_Cost, Job_Total_Cost, Address_ID, Customer_ID)

VALUES ('R', 10.5, 'mornings only', '2018-09-01', '2018-09-05', 45.00, 105.00, 10.00, 160.00, 3, 3);

Explanation / Answer

---> To select the several entiries based on the particular attribute you have to write the simple select statement with where condition like below.
For example we want to retrieve the entries having the job total cost greater than 130. Now the query will be below.

The above query retrieves the entiries having total cost greater than 130 with the customerid, status and total cost. If we want all the columns then we have to put simply * in the place of columns list like below.


---> To select several entries based on set of attributes is also the same like above but here we write conditions on more than one column . like below

The above query will retrieve the entiries having status as B and the hours greater than 3 in the order of ascending order of the column status.