Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lesiaukr/goit-rdb-hw-05
Master's degree. Relational databases: Nested requests | Code reuse
https://github.com/lesiaukr/goit-rdb-hw-05
code-reuse goit-rdb-hw-05 nested-in-from nested-in-select nested-in-where nested-in-with nested-sql-queries
Last synced: 21 days ago
JSON representation
Master's degree. Relational databases: Nested requests | Code reuse
- Host: GitHub
- URL: https://github.com/lesiaukr/goit-rdb-hw-05
- Owner: LesiaUKR
- Created: 2024-04-08T14:46:01.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-04-09T11:16:57.000Z (9 months ago)
- Last Synced: 2024-04-09T14:26:00.882Z (9 months ago)
- Topics: code-reuse, goit-rdb-hw-05, nested-in-from, nested-in-select, nested-in-where, nested-in-with, nested-sql-queries
- Homepage:
- Size: 1.04 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# goit-rdb-hw-05
Master's degree. Relational databases: Nested requests | Code reuse
1. Write an SQL query that displays the order_details table and the customer_id field from the orders table respectively for each record in the order_details table. This should be done using a nested query in the SELECT statement.
2. Write an SQL query that displays the order_details table. Filter the results to ensure that the corresponding record from the orders table satisfies the condition shipper_id=3. This should be done using a nested query in the WHERE clause.
3. Write an SQL query, nested in the FROM clause, that selects rows with the condition quantity>10 from the order_details table. For the obtained data, find the average value of the quantity field — group by order_id.
4. Solve task 3 using the WITH operator to create a temporary table temp. If your MySQL version is earlier than 8.0, create this query by analogy to how it is done in the notes.
5. Create a function with two parameters that will divide the first parameter by the second. Both parameters and the returned value should have the FLOAT type. Use the DROP FUNCTION IF EXISTS construct. Apply the function to the quantity attribute of the order_details table.