Question

In: Computer Science

this question is based on tables listed below: CUSTOMER CustNo Custname Phone 100 Smith 999-1111 200...

this question is based on tables listed below:

CUSTOMER

CustNo Custname Phone
100 Smith 999-1111
200 Jones 222-3456
300 Bruce 123-9999
400 Tan 888-4321

CAR

RegistrationNo Make
9AA 321 Holden
6KZ 516 Datsun
8ZZ 999 Ford
7YT 555 Holden

RENTAL

RentalNo CustNo Registration DateRented
1 200 9AA 321 7-Oct-15
2 300 6KZ 516 7-Oct-15
3 200 8ZZ 999 18-Oct-15
4 100 6KZ 516 12-Nov-15
5 300 9AA 321 14-Nov-15

Give SQL statements for each of the following:

a. list all the cars rented by customer Smith since 1 November 2015.

b. list each make of car, and the total number of cars of that make.

c. list the registration number of all the cars that have never been rented.

d. change the phone number of customer jones to 999-1234.

Solutions

Expert Solution

Dear Student ,

As per the requirement submitted above , kindly find the below solution.

Question a:

SQL Query :

select RENTAL.Registration,Make from RENTAL,CAR,CUSTOMER
where RENTAL.RegistrationNo=CAR.RegistrationNo and
RENTAL.CustNo=CUSTOMER.CustNo and Custname='Smith' and
DateRented > '1-Nov-15';

Explanation :

  • Above sql query will join three tables RENTAL,CAR,CUSTOMER
  • and will return the details.

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

Question b:

SQL Query :

select Make,count(RegistrationNo) as 'total number of cars' from RENTAL
group by Make;

Explanation :Above sql query will count the number of cars by make.

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

Question c:

SQL Query :

select RegistrationNo from Car where RegistrationNo not in
(select RegistrationNo from RENTAL);

Explanation :Above sql query will list all the RegistrationNo that never been rented.

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

Question d:

SQL Query :

update CUSTOMER set Phone='999-1234' where Custname='Jones';

Explanation :Above sql query will update the phone number.

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

NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.


Related Solutions

QUESTION 1 For the salesdb tables loaded in your environment, the table specifications are below: CUSTOMER...
QUESTION 1 For the salesdb tables loaded in your environment, the table specifications are below: CUSTOMER (custno, lname, fname, mname, email, mobile, addrln1, addrln2, addrln3, city, state, zip, status) PRODUCT (prodno, sku, unit, long_desc, short_desc, unitprice, qty_on_hand, qty_on_order) SALES (salesno, saledate, custno, prodno, salesqty, unitprice, lineamount, taxable, taxrate, discountrate) Write SQL that will list the sales to custno=11, Eva Santis. The resultset should include: custno, fname, lname, salesno, prodno, long_desc, product unitprice, salesqty, totalcost for each line item. Test your...
Problem: Read the following tables and answer the following questions: Customers Customer ID Name Address Phone...
Problem: Read the following tables and answer the following questions: Customers Customer ID Name Address Phone Email 9087 John Doe 204 University Ave. 987-098-9087 [email protected] 2098 Bill Lawrence 123 Jones St 717-387-3387 Business 2398 Laura Smith 0900 West Blvd. 901-234-4567 Information Transactions Customer ID Account Number Date of Last Transaction 9087 375 01/31/98 2098 123 03/09/97 2398 375 09/21/97 2098 375 12/31/97 2398 123 02/01/98 Accounts Account Number Balance Account Type 375 234.45 Checking 123 056.90 Savings 1. Who owns...
Question 6 – 8 refer to prospect H and K below ? = ($100, 0.4; $200,...
Question 6 – 8 refer to prospect H and K below ? = ($100, 0.4; $200, 0.6) ? = ($120, ?; $300, 1 − ?) 6. ?V(?) = ?V(?). What value of p makes this statement true? 7. Carol owns prospect H and is interested in selling it. Her utility of wealth function is given by ?(?) = ?^0.5. What is the lowest price for which Carol would be willing to sell prospect H? 8. True or False: The lowest...
Listed below are the rental agencies in the Automobile Rental section in the phone directory. Also...
Listed below are the rental agencies in the Automobile Rental section in the phone directory. Also noted is whether the rental agency is local (L), national (N), and whether the agency rents pickup trucks (T). Note that an agency could provide more than one service. Some of the agencies are to be randomly selected and asked various questions regarding the service they provide. 00 ADA Auto Rentals L 10 General Motors Rental System L,N,T 01 Alamo Rent a Car L,N...
Tables CUSTOMER CustomerID FirstName LastName Address Phone LicenseNo 1 David Hacker 101 Yammba road, Rockhampton 0749008877...
Tables CUSTOMER CustomerID FirstName LastName Address Phone LicenseNo 1 David Hacker 101 Yammba road, Rockhampton 0749008877 089 777 123 2 Tony Morrison 98 South street, Melbourne 0490787772 088777555 3 Issac Newton 90 Heaven road, Sydney 0299001122 099 776 123 4 James Farrell 101 St Lucia Garden, Brisbane 0733099000 090 566 777 5 David Land 345 Illinois road, Brisbane 0739000554 456 000 999 6 Peter Garry 201 South port road, Gold Coast 0745676766 234 090 767 RENTAL RentalID CustomerID RegoNo StartDate...
Three tables listed below show random variables and their probabilities. However, only one of these is...
Three tables listed below show random variables and their probabilities. However, only one of these is actually a probability distribution. A B C x P(x) x P(x) x P(x) 25 0.1 25 0.1 25 0.1 50 0.6 50 0.6 50 0.6 75 0.1 75 0.1 75 0.1 100 0.2 100 0.4 100 0.6 a. Which of the above tables is a probability distribution? (Click to select)  A  B  C b. Using the correct probability distribution, find the probability that x is: (Round the...
Three tables listed below show random variables and their probabilities. However, only one of these is...
Three tables listed below show random variables and their probabilities. However, only one of these is actually a probability distribution. Table 1: X    P(X) Table 2: X    P(X)              Table 3:   X    P(X)                25     0.1                           25     -0.6                        25        0.5               50      0.7                           50    0.2                            50      0.3               75     0.2                            15    0.1                            75       0.1               100   0.4                            100    0.1                          100    0.1 a. Which of the above tables is a probability distribution? b.Using the correct probability distribution, find the probability that x is...
1) In Canada, a worker who works 40 hours can produce 200 chairs or 100 tables....
1) In Canada, a worker who works 40 hours can produce 200 chairs or 100 tables. In Norway, a worker who works 40 hours can produce 240 chairs or 80 tables. Give one trade, in terms of chairs per table, at which the two countries would both be willing to trade. 2)In Canada, a worker who works 40 hours can produce 200 chairs or 100 tables. In Norway, a worker who works 40 hours can produce 240 chairs or 80...
For these questions you answer them using one of the charts/tables listed below. Table • Bar...
For these questions you answer them using one of the charts/tables listed below. Table • Bar chart • Grouped bar chart • Segmented bar chart • Pictograms • Gantt chart • Line chart • Area chart • Pie charts • Map • Flowchart a.Data showing the growth in the number of students using PDAs during the past three years. Line Graph b. Data showing the distribution of contributions to the company's education matching gifts program by functional unit. Pie Chart...
Write a query to display the columns listed below. For each customer the query should show...
Write a query to display the columns listed below. For each customer the query should show the current system date, the current day (when you do the problem the date and day will be different), the number of characters in the member last name, the last date the customer rented a video and how many total videos the person rented. /* Database Systems, 9th Ed., Coronel/MOrris/Rob */ /* Type of SQL : MySQL */ CREATE SCHEMA IF NOT EXISTS TINY_VIDEO;...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT