Looking for DataBase Fundamentals new test answers and solutions? Browse our comprehensive collection of verified answers for DataBase Fundamentals new at softserve.academy.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
sales
, which contains information about sales transactions. The sales
table has columns for the date of the transaction, the name of the salesperson, the product sold, and the amount of the sale. You want to create a grouped view that shows the total sales amount for each salesperson and product combination.Example of the sales
table:
sale_date | salesperson | product | sale_amount |
---|---|---|---|
2022-03-01 | John Smith | Product A | 100.00 |
2022-03-01 | Jane Doe | Product B | 75.00 |
2022-03-02 | John Smith | Product C | 50.00 |
2022-03-03 | Bob Johnson | Product A | 25.00 |
2022-03-03 | Jane Doe | Product B | 150.00 |
Which of the following CREATE VIEW statements would accomplish this?
customers
and orders
, with the following data:customers
table:
customer_id | customer_name | address | city |
---|---|---|---|
1 | John Smith | 123 Main St. | Anytown |
2 | Jane Doe | 456 Oak St. | Other town |
3 | Bob Johnson | 789 Maple Ave. | Another town |
orders
table:
order_id | customer_id | order_date | total_amount |
---|---|---|---|
1 | 1 | 2022-03-01 | 150.00 |
2 | 2 | 2022-03-02 | 75.00 |
3 | 1 | 2022-03-03 | 25.00 |
4 | 3 | 2022-03-04 | 50.00 |
Which of the following CREATE VIEW statements would create a vertical view that displays the customer name, order ID, and total amount for all orders?
orders
, order_details
and customers
. The orders
table contains basic information about each order, including the order ID and customer ID, customers
table contains information about customer, while the order_details
table contains the details of each order, including the product ID, quantity, and price. You want to create a view that shows the order ID, customer name, product name, quantity, and price for all orders.
Example of the orders
table:
order_id | customer_id | order_date |
---|---|---|
1 | 1 | 2022-03-01 |
2 | 2 | 2022-03-02 |
3 | 1 | 2022-03-03 |
4 | 3 | 2022-03-04 |
Example of the order_details
table:
order_id | product_id | quantity | price |
---|---|---|---|
1 | 1 | 3 | 10.00 |
2 | 2 | 5 | 15.00 |
1 | 3 | 2 | 20.00 |
4 | 1 | 1 | 8.50 |
Example of the customers
table:
customer_id | customer_name | city |
---|---|---|
1 | Laurence Lebihan | London |
2 | Diego Roel | Madrid |
Which of the following CREATE VIEW statements would accomplish this?
orders
and products
. You want to create a view that shows the order ID, product name, and quantity for all orders that include a particular product. Which of the following CREATE VIEW statements would accomplish this?Table Example:orders
table:| order_id | product_id | quantity |
|----------|------------|----------|
| 1 | 1 | 3 |
| 2 | 2 | 5 |
| 3 | 1 | 2 |
| 4 | 3 | 1 |
products
table:
| id | product_name |
|----|--------------|
| 1 | Widget A |
| 2 | Widget B |
| 3 | Widget C |
What is the difference between a regular view and a materialized view in PostgreSQL?
What is the benefit of using materialized (indexed) views?
Which type of view combines data from one or more base tables (or views) into a new virtual table?
What is a SQL View?
table_name
with a specific condition in PostgreSQL?sales
with columns id
, product_name
, quantity
, and price
. You want to update the column total_price
by multiplying the quantity
and price
columns. Which SQL statement will achieve this?Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!