Q9: Write an SQL query using CASE to calculate the grade for each student:
If the avg of math and science scores is greater than or equal to 90, assign A grade.
If the avg is between 80 & 89, assign B grade
If the avg is between 70 & 79, assign C grade
Otherwise, assign 'D'.
Q8: Write an SQL query to calculate the month-over-month percentage growth for each product's sales. You should retrieve the product_id, sale_date, and percentage growth from the previous month's sales using the LEAD and LAG functions.
Protip: ๐ Do you know that using the LEAD and LAG functions effectively and considering both the PARTITION BY and ORDER BY clauses, you can perform robust time-based and comparative analysis on your data in Oracle SQL. ๐
Q7: In Oracle SQL, the LIMIT function is unavailable, but there's an equivalent approach using the ROWNUM technique. Consider a table named "products" as per the screenshot.
Write an SQL query to retrieve the top 3 cheapest products using the ROWNUM technique (equi. to LIMIT).
A master class in creating Synthetic datasets with LLMs! ๐
ToolLLM paper has been popular for creating the strongest API following models.
I think thereโs an incredibly underrated side to it, hereโs my summary:
- The paper aims to improve API following capabilities of open source models
- The first step is to collect a large set of API call examples along with its documentation
- Low quality ones that donโt work are filtered out
- ChatGPT is used to annotate and provide reasoning for examples
- Depth First Search, a new prompting strategy is the key to making the above step work
- The open source models are fine tuned on these
- Finally a retrieval model is trained to fetch the correct APIs to call during inference
The paper has many other interesting angles as well. For me the pipeline above was a master class on how to create synthetic datasets with Large Language Models:
https://t.co/Fokn3h4AwA
Question #6: Imagine you have a table named "events" with the attached structure and data:
Write an SQL query to extract the hours, minutes, and seconds from the "event_date" column and display them in separate columns in the result set.
Hint: Use the TO_CHAR function.
The result displays the "event_id," "event_date," and the extracted hours, minutes, and seconds from the "event_date" column in the specified format with leading zeros as required.
#tutorsql#to_char