1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ratelena [41]
2 years ago
11

I need the SQL statements for these questions:

Computers and Technology
1 answer:
zimovet [89]2 years ago
4 0

Answer:

Explanation:

/* From the information provided, For now will consider the name of table as TRIPGUIDES*/

/*In all the answers below, the syntax is based on Oracle SQL. In case of usage of other database queries, answer may vary to some extent*/

1.

Select R.Reservation_ID, R.Trip_ID , C.Customer_Num,C.Last_Name from Reservation R, Customer C where C.Customer_Num=R.Customer_Num ORDER BY C.Last_Name

/*idea is to select the join the two tables by comparing customer_id field in two tables as it is the only field which is common and then print the desired result later ordering by last name to get the results in sorted order*/

2.

Select R.Reservation_ID, R.Trip_ID , R.NUM_PERSONS from Reservation R, Customer C where C.Customer_Num=R.Customer_Num and C.LAST_NAME='Goff' and C.FIRST_NAME='Ryan'

/*Here, the explaination will be similar to the first query. Choose the desired columns from the tables, and join the two tables by equating the common field

*/

3.

Select T.TRIP_NAME from TRIP T,GUIDE G,TRIPGUIDES TG where T.TRIP_ID=TG.TRIP_ID and TG.GUIDE_NUM=G.GUIDE_NUM and G.LAST_NAME='Abrams' and G.FIRST_NAME='Miles'

/*

Here,we choose three tables TRIP,GUIDE and TRIPGUIDES. Here we selected those trips where we have guides as Miles Abrms in the GUIDES table and equated Trip_id from TRIPGUIDES to TRIP.TRIP_Name so that can have the desired results

*/

4.

Select T.TRIP_NAME

from TRIP T,TRIPGUIDES TG ,G.GUIDE

where T.TRIP_ID=TG.TRIP_ID and T.TYPE='Biking' and TG.GUIDE_NUM=G.GUIDE_NUM and G.LAST_NAME='Boyers' and G.FIRST_NAME='Rita'

/*

In the above question, we first selected the trip name from trip table. To put the condition we first make sure that all the three tables are connected properly. In order to do so, we have equated Guide_nums in guide and tripguides. and also equated trip_id in tripguides and trip. Then we equated names from guide tables and type from trip table for the desired results.

*/

5.

SELECT C.LAST_NAME , T.TRIP_NAME , T.START_LOCATION FROM CUSTOMER C, TRIP T, RESERVATION R WHERE R.TRIP_DATE='2016-07-23' AND T.TRIP_ID=R.TRIP_ID AND C.CUSTOMER_NUM=R.CUSTOMER_NUM

/*

The explaination for this one will be equivalent to the previous question where we just equated the desired columns where we equiated the desired columns in respective fields and also equated the common entities like trip ids and customer ids so that can join tables properly

*/

/*The comparison of dates in SQL depends on the format in which they are stored. In the upper case if the

dates are stored in the format as YYYY-MM-DD, then the above query mentioned will work. In case dates are stored in the form of a string then the following query will work.

SELECT C.LAST_NAME , T.TRIP_NAME , T.START_LOCATION FROM CUSTOMER C, TRIP T, RESERVATION R WHERE R.TRIP_DATE='7/23/2016' AND T.TRIP_ID=R.TRIP_ID AND C.CUSTOMER_NUM=R.CUSTOMER_NUM

*/

6.

Select R.RESERVATION_ID, R.TRIP_ID,R.TRIP_DATE FROM RESERVATION R WHERE R.TRIP_ID IN

{SELECT TRIP_ID FROM TRIP T WHERE STATE='ME'}

/*

In the above question, we firstly extracted all the trip id's which are having locations as maine. Now we have the list of all the trip_id's that have location maine. Now we just need to extract the reservation ids for the same which can be trivally done by simply using the in clause stating print all the tuples whose id's are there in the list of inner query. Remember, IN always checks in the set of values.

*/

7.

Select R.RESERVATION_ID, R.TRIP_ID,R.TRIP_DATE FROM RESERVATION WHERE

EXISTS {SELECT TRIP_ID FROM TRIP T WHERE STATE='ME' and R.TRIP_ID=T.TRIP_ID}

/*

Unlike IN, Exist returns either true or false based on existance of any tuple in the condition provided. In the question above, firstly we checked for the possibilities if there is a trip in state ME and TRIP_IDs are common. Then we selected reservation ID, trip ID and Trip dates for all queries that returns true for inner query

*/

8.

SELECT G.LAST_NAME,G.FIRST_NAME FROM GUIDE WHERE G.GUIDE_NUM IN

{

SELECT DISTINCT TG.GUIDE_NUM FROM TRIPGUIDES TG WHERE TG.TRIPID IN {

SELECT T.TRIP_ID FROM TRIP T WHERE T.TYPE='Paddling'

}

}

/*

We have used here double nested IN queries. Firstly we selected all the trips which had paddling type (from the inner most queries). Using the same, we get the list of guides,(basically got the list of guide_numbers) of all the guides eds which were on trips with trip id we got from the inner most queries. Now that we have all the guide_Nums that were on trip with type paddling, we can simply use the query select last name and first name of all the guides which are having guide nums in the list returned by middle query.

*/

You might be interested in
show how one version of the technology is an improvement over a previous iteration of that same technology
Romashka-Z-Leto [24]
This question has a ton of answers to it but, here are some basic ideas to help you out
- Cars 1900's vs today
- Computers 1980's vs today
- Guns 1800's vs today
- Televisions 1900's vs today
- Telescopes/Microscopes
7 0
3 years ago
Explain the concept of risk management, including risk identification, assessment, and control.
abruzzese [7]

Answer:

Risk management is the technique that is used for managing the risky situation so that security of the system or organization can be maintained. The risk can be reduced by parameters like monitoring the system,alertness, preventive measures etc. There are terms related with the risk management for prevention of the risk such as risk control ,risk identification and risk assessment .

  • Risk control is the method that is used for calculating the loss or damage experience and then taking the correct measures to reduce the loss and thus, controlling the risk.
  • Risk assessment is the analyzation of the threats and source of damage/loss that is caused or can be caused by assessing the whole process and functioning.
  • Risk identification is the technique through which the threat is listed over a document and sorted in accordance with the category of risk, risk response etc.  

7 0
3 years ago
Suppose there are 69 packets entering a queue at the same time. Each packet is of size 7 MiB. The link transmission rate is 1.7
svp [43]

Answer:

69.08265412 milliseconds

Explanation:

Lets first convert 7 MiB to bits

7*1024*1024*8=58720256 bits

Now convert bits to Gbits

58720256/10^{9}  =0.058720256 Gbits

Queuing Delay = Total size/transmission link rate

Queuing Delay= \frac{0.058720256}{1.7} =0.03454132706 seconds

Delay of packet number 3 = 0.03454132706*2=0.06908265412 seconds

or 0.06908265412= 69.08265412 milliseconds

7 0
3 years ago
Round Robin Algorithm
Reil [10]

Answer:

Please check the attachment.

Explanation:

avg turnaround time = (38+7+42+33+18)/5= 27.6

avg waiting timee = (33+5+28+23+17)/5= 21.2

And its D, A C in Gantt chart at last and exit time are 33, 38 and 42 mentioned as last three in Gantt chart.

7 0
2 years ago
What does the /var directory contain?
Ghella [55]

Answer:A

Explanation:

The /var Directory. /var is a standard subdirectory of the root directory in Linux and other Unix-like operating systems that contains files to which the system writes data during the course of its operation

3 0
3 years ago
Other questions:
  • The _____ is a computer-based test that measures the degree to which you associate particular groups of people with specific cha
    13·1 answer
  • Based on the current economic situation do you expect the employment demand for graduating engineers to increase or decrease? Ex
    9·1 answer
  • Which object waits for and responds toan event from a GUI component?
    9·1 answer
  • What are the coordinates of (3 comma space 8 )relative to the basis open curly brackets space (1 comma space 1 )comma space (0 c
    15·1 answer
  • Please help me with these questions
    5·1 answer
  • When a speaker is finished talking, you should allow for _____.
    14·2 answers
  • You're an administrator for a large corporation and you are responsible for deploying computers often and quickly. What server d
    10·1 answer
  • When is 1600 plus 25 and 1700 minus 35 the same thing?​
    10·1 answer
  • How to identify mistakes in a html code??​
    14·1 answer
  • What is one disadvantage people face without a checking account?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!