Question

Given the following relational schema, write queries in SQL to answer the English questions. There is...

Given the following relational schema, write queries in SQL to answer the English questions. There is a shipment database on the MySQL server. You can also use the DDL for MySQL. You must only submit the SQL for your answers but you can include the query output as well to help the TA with marking.

Customer(cid: integer, cname: string, address: string, city: string, state: string)
Product(pid: integer, pname: string, price: currency, inventory: integer)
Shipment(sid: integer, cid: integer, shipdate: Date/Time)
ShippedProduct(sid: integer, pid: integer, amount: integer)
  1. Return the number of shipments to customers with first name 'Scott'.

    Output:

    +----------+
    | count(*) |
    +----------+
    |        3 |
    +----------+
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

Number of shipments to customers with first Name "Scott"

Query:

select count(*) from Shipment s
join Customer c on c.cid = s.cid
where c.cname = "Scott";

/*This query will return the total no of shipments to Customer Scott*/

Let me know in case if you have any questions. Thanks and All the best.

Add a comment
Know the answer?
Add Answer to:
Given the following relational schema, write queries in SQL to answer the English questions. There is...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Given the following relational schema, write queries in SQL to answer the English questions. There is...

    Given the following relational schema, write queries in SQL to answer the English questions. There is a shipment database on the MySQL server. You can also use the DDL for MySQL. You must only submit the SQL for your answers but you can include the query output as well to help the TA with marking. Customer(cid: integer, cname: string, address: string, city: string, state: string) Product(pid: integer, pname: string, price: currency, inventory: integer) Shipment(sid: integer, cid: integer, shipdate: Date/Time) ShippedProduct(sid:...

  • Given the following relational schema, write queries in SQL to answer the English questions. The Access...

    Given the following relational schema, write queries in SQL to answer the English questions. The Access Database for the schema is available, as is a DDL file. It is also available on the MySQL server. You must only submit the SQL for your answers. You can get your answers without using a DBMS or by using Access or MySQL. Customer(cid: integer, cname: string, address: string, city: string, state: string) Product(pid: integer, pname: string, price: currency, inventory: integer) Shipment(sid: integer, cid:...

  • EXERCISE 1 (SQL Queries) Consider the following schema: SUPPLIERS (SID : integer, SNAME : string, CITY...

    EXERCISE 1 (SQL Queries) Consider the following schema: SUPPLIERS (SID : integer, SNAME : string, CITY : string) PARTS (PID : integer, PNAME : string, COLOR : string) CATALOG (SID : integer, PID : integer, COST : real) The key fields are underlined, and the domain of each field is listed after the field name. Thus, SID is the key for SUPPLIERS, PID is the key for PARTS, and SID and PID together form the key for CATALOG. The CATALOG...

  • Answer the following five (5) questions, based on the schema provided.

    C. Answer the following five (5) questions, based on the schema provided.Consider the following schema:Supplier (sid: integer, sname: string, address: string)Part(pid: integer, pname: string, , color: string)Catalog(sid: integer, pid: integer, cost: real)The relation Supplier stores suppliers and the primary key of that relation is sid. The relation Part stores parts, and pid is the primary key of that relation. Finally, Catalog stores which supplier supplies which part and at which cost (price). The primary key is the combination of the...

  • In .sql Given the following relational schemas, answer the following questions: Suppliers(sid: int, sname: VARCHAR(30), address:...

    In .sql Given the following relational schemas, answer the following questions: Suppliers(sid: int, sname: VARCHAR(30), address: VARCHAR(50)) Parts(pid: int, pname: VARCHAR(30), color: VARCHAR(10)) Catalog(sid: int, pid: int, cost: double) c. (8 points) List sid, sname, and address of all suppliers who supply at least one part. In other words, the answer must not show sid and sname of any supplier who does not have its sid in the Catalog table d. (4 points) Find all distinct black parts in the...

  • Please finish all parts, thanks! 2) Consider the following schema: Suppliers(sid: integer, sname: string, address: string) Parts(pid:integer, pname: string, color: string ) Catalog( sid: integer, pid...

    Please finish all parts, thanks! 2) Consider the following schema: Suppliers(sid: integer, sname: string, address: string) Parts(pid:integer, pname: string, color: string ) Catalog( sid: integer, pid: integer, cost: real) Write the following queries in relational algebra. a) Find the names of suppliers who supply some red part b) Find the sids of suppliers who supply some red or green part c) Find the sids of suppliers who supply some red and some green part. d) Find the sids of suppliers...

  • Please HELP, THANK YOU SO MUCH Consider the below schema of the university database (keys are...

    Please HELP, THANK YOU SO MUCH Consider the below schema of the university database (keys are in bold and underline) Part(pid: string, pname: string, description: string, color: string) Department(did: string, dnamestring, address: string) Supplier(sid string,.sname:string, address:string) Order(did:string. sid string pidstring, time:string, quantityreal, pricereal) The key fields are underlined, and the domain of each field is listed after the field name. Thus pid is the key for Part, did is the key for Department, sid is the key for Supplier, and...

  • Consider the following schema: SUPPLIERS (SID: integer, SNAME: string, STREET: string, CITY: string, ZIP: string) PARTS...

    Consider the following schema: SUPPLIERS (SID: integer, SNAME: string, STREET: string, CITY: string, ZIP: string) PARTS (PID: integer, PNAME: string, COLOR: string) CATALOG (SID: integer, PID: integer, COST: real) The primary key attributes are underlined, and the domain of each attribute is listed after the attribute name. Thus, SID is the primary key for SUPPLIERS, PID is the primary key for PARTS, and SID and PID together form the primary key for CATALOG. Attribute SID in CATALOG is a foreign...

  • ***SQL DML*** Write SQL statements to answer the following questions. Note that you do not need...

    ***SQL DML*** Write SQL statements to answer the following questions. Note that you do not need data tuples to answer these questions. Use the following relational schema. Supplier (sid, name, status, city) Part (pid, name, color, weight, city) Job (jid, name, city) Supplies (/sid/, /pid/, /jid/, quantity) Use subquery, what are the id and the name of all suppliers, whose total quantity is larger than the total quantity of all suppliers in city ‘London’?

  • HELP DATABASE QU Question 1: Think About the relational database table data as given below, write...

    HELP DATABASE QU Question 1: Think About the relational database table data as given below, write the following queries in Oracle SQL. Company (Cid, Cname, City, Budget, Branch) Department (Deptno, Dname, Building, Cname) Employee (Ename, Deptno, Street, City, Phone, Salary) Works (Ename, Deptno, Hire_date) Location (Cname, Location ) 1. Write Query to Create the Company table, suggest appropriate data type of each attribute, consider that there should be a name for each company. 2. Find employee name/names who live in...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT