GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

Dave and Jane file a joint return. They sell a capital asset…

Dave and Jane file a joint return. They sell a capital asset at a $140,000 loss. Even though they have no capital gains, $3,000 of the loss can still be deducted in the current year if they have at least $3,000 of ordinary income.

Read Details

 The Color of Law suggests that federal housing laws have al…

 The Color of Law suggests that federal housing laws have always been applied to or impacted Blacks and Whites equally.

Read Details

Largely as a result of federal policies, Ferguson, MO has be…

Largely as a result of federal policies, Ferguson, MO has become a predominantly White city with a very small Black population:

Read Details

Which of the following is the phase of emergency management…

Which of the following is the phase of emergency management that deals with assembling emergency provisions (e.g., a go-bag)?

Read Details

Long-term care provides a wide scope of services for people…

Long-term care provides a wide scope of services for people that require a higher level of daily care due to some loss of independence, including conducting tasks called activities of daily living. Which of the following is considered an activity of daily living?

Read Details

The children of an 80-year-old father discuss the possibilit…

The children of an 80-year-old father discuss the possibility of moving the father closer to the two children that are in close proximity. The father is agreeable but does not want to live in a “nursing home.” He has the ability to manage daily activities but would appreciate being around others his age. Which of the following types of long-term care facilities would be suitable?  

Read Details

The following SQL query creates a table named gym with the f…

The following SQL query creates a table named gym with the following columns and data: DROP TABLE IF EXISTS gym;CREATE TABLE gym (trans_id int PRIMARY KEY, userid text, workout_type text, calories_burned int, checkin timestamp, duration int);INSERT INTO gym VALUES(1,’user_1063′,’CrossFit’,429,’2023-06-01 07:06:00′,38),(2,’user_1104′,’Swimming’,954,’2023-06-01 10:54:00′,67),(3,’user_1014′,’CrossFit’,1464,’2023-06-02 08:52:00′,140),(4,’user_1010′,’CrossFit’,1325,’2023-06-02 11:50:00′,61),(5,’user_1010′,’Weightlifting’,344,’2023-06-03 06:24:00′,127),(6,’user_1098′,’Yoga’,344,’2023-06-03 12:06:00′,48),(7,’user_1071′,’Swimming’,1102,’2023-06-03 14:29:00′,112),(8,’user_1034′,’Yoga’,849,’2023-06-03 17:14:00′,133),(9,’user_1023′,’CrossFit’,723,’2023-06-04 09:02:00′,139),(10,’user_1063′,’Cardio’,1028,’2023-06-04 16:27:00′,122),(11,’user_1034′,’Pilates’,698,’2023-06-04 19:15:00′,128),(12,’user_1010′,’Yoga’,672,’2023-06-05 08:58:00′,168),(13,’user_1006′,’Weightlifting’,291,’2023-06-05 09:13:00′,122),(14,’user_1023′,’Weightlifting’,1682,’2023-06-05 11:00:00′,170),(15,’user_1028′,’Weightlifting’,432,’2023-06-05 20:20:00′,177),(16,’user_1071′,’CrossFit’,948,’2023-06-06 06:48:00′,55),(17,’user_1104′,’Yoga’,805,’2023-06-06 15:09:00′,158),(18,’user_1006′,’Yoga’,998,’2023-06-07 08:12:00′,151),(19,’user_1010′,’Swimming’,502,’2023-06-07 08:56:00′,171),(20,’user_1063′,’Cardio’,1058,’2023-06-07 09:28:00′,65),(21,’user_1097′,’Yoga’,1169,’2023-06-07 14:26:00′,84),(22,’user_1071′,’Weightlifting’,1012,’2023-06-08 06:02:00′,157),(23,’user_1104′,’Yoga’,1602,’2023-06-08 16:29:00′,155),(24,’user_1071′,’Weightlifting’,1194,’2023-06-09 07:07:00′,159),(25,’user_1023′,’Yoga’,322,’2023-06-11 09:48:00′,113),(26,’user_1063′,’CrossFit’,1387,’2023-06-11 13:03:00′,179),(27,’user_1063′,’CrossFit’,637,’2023-06-14 13:45:00′,146) ; Source: https://www.kaggle.com/datasets/mexwell/gym-check-ins-and-user-metadata Here are brief descriptions of the data fields: trans_id: unique identifier for the visit userid: ID of the user who checked in workout_type: Type of workout performed during the visit calories_burned: Estimated number of calories burned during the workout checkin: date and time user checked in duration: time from check in to completion of workout (minutes) Using pgAdmin, execute the table creation script provided above to initialize your dataset. Then, construct a SQL query that accomplishes the following tasks using a Common Table Expression (CTE) structure, organized into three logical parts: Part 1: Daily Aggregation by Workout Type Each user can only check in once per day. Your first step is to extract the date component from the checkin timestamp and alias it as checkin_date. Then, aggregate the data at the (workout_type, checkin_date) level to compute: cal_per_min: Represents the daily rate of calories burned per minute for each workout_type, computed by dividing the total daily calories_burned by the corresponding total daily duration. This metric captures workout intensity on a per-minute basis across individual exercise types. Your output should include the following three columns: workout_type, checkin_date, and cal_per_min. –> Example: On 2023-06-04, about 8.43 was burned  per minute for Cardio; On 2023-06-01, about 11.29 was burned  per minute for CrossFit ;  Part 2: Moving and Overall Averages Create an additional CTE based on the results from Part 1 to compute the following metrics: Part 2.1: 3-Day Moving Average  For each workout type and check-in date, calculate a 3-day moving average of cal_per_min, considering only the three most recent prior check-in dates, excluding the current date and any future dates (based on actual check-in history, not calendar days). Name this column cal_pm_3dma.  Additionally, count the number of days included in each moving average window and store this as num_days. Part 2.2: Overall Average Within the same CTE as Part 2.1, use a different window frame to compute the overall average of cal_per_min for each workout type across all available check-in dates. Name this column cal_pm_avg. Part 3: Final Output Return the following columns: workout_type, checkin_date, cal_per_min, cal_pm_3dma, cal_pm_avg Filter the results to include only those rows where the 3-day moving average (cal_pm_3dma) is based on a full window of three prior days.   The final result set should align with the structure and layout of the output shown below, with the exception of minor rounding differences. workout_type checkin_date cal_per_min cal_pm_3dma cal_pm_avg CrossFit 2023-06-06 17.24 10.12 9.95 CrossFit 2023-06-11 7.75 12.10 9.95 CrossFit 2023-06-14 4.36 10.06 9.95 Weightlifting 2023-06-09 7.51 4.76 5.45 Yoga 2023-06-07 9.22 5.23 6.35 Yoga 2023-06-08 10.34 6.11 6.35 Yoga 2023-06-11 2.85 8.22 6.35 Here is a template to follow for constructing the query:– Use common table expression to write the query in three partsWITH daily_agg AS ( –Part 1 ),sec_agg AS ( –Part 2) — Part 3SELECT  Submit your complete query in the window below.

Read Details

An________________describes one who actively interprets shar…

An________________describes one who actively interprets shared material and analyzes the content and speaker’s effectiveness.

Read Details

A researcher discovers a new mutation in a Drosophila strain…

A researcher discovers a new mutation in a Drosophila strain that causes bicoid mRNA to be evenly distributed throughout the egg cytoplasm instead of being localized at the anterior end, causing Bicoid protein to occur at high levels throughout the entire embryo. Using the simplified interaction network below, select all reasonable outcomes of this mutation in the progeny (true/false). Caudal will be inhibited throughout the embryo. [blank1] Hunchback will be activated throughout the embryo. [blank2] Kruppel will be inhibited throughout the embryo. [blank3] The embryo will live a normal and healthy life and likely produce normal and healthy offspring. [blank4]  

Read Details

A researcher performs ChIP-seq on fly embryos using an antib…

A researcher performs ChIP-seq on fly embryos using an antibody against a Hox transcription factor, Antennapedia (Antp), which is expressed in the body segment that specifies a wing in the fly (T2; see diagram in the previous question). Given what we know about Hox function, which is the most logical prediction of the data/result we could expect to be returned?

Read Details

Posts pagination

Newer posts 1 … 29,066 29,067 29,068 29,069 29,070 … 98,050 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top