Window Functions in SQL

🔔 Prelude: Boss: “I need the average sales for 7 days.” Me: “Sure! Which 7 days?” Boss: “All the 7 days!” Me: “Su…Sure…?” 🖋️ Window Functions Window functions are generally applied after aggregate functions like MAX(), MIN(), AVG() to perform calculations across a set of table rows(days before, days after) that are related to the current row(current day). Example Table 1: employees employee_id department_id salary 1 101 5000 2 101 6000 3 101 5500 4 102 7000 5 102 7200 6 102 6800 Example 1: OVER() Without Partitioning Calculate the average salary for all employees: ...

2026-09-10

CO-STAR Template for ChatGPT

🔔 Prelude: If you use ChatGPT frequently, you’ve probably encountered situations where it provides off-topic answers. Since we can’t modify the model, the better approach is to rely on accurate prompts and additional context. 🖋️ Main Let ChatGPT Answer Your Questions Accurately! First, you need to let ChatGPT know some personal information about you and how it should respond to you. Click on your profile picture at the top right corner. Select “Customize ChatGPT.” Hover over the “Custom Instructions” question mark on the right and fill in the information as guided. Use the specific CO-STAR template in a new session. Interact with ChatGPT. CO-STAR Template The CO-STAR template is a structured method that can help you communicate more clearly and effectively with ChatGPT. By providing context, objectives, style, tone, audience, and response format, you can explain exactly what you need from ChatGPT, and get replies that correspond more closely with your requirements. ...

2026-09-10

Tips for Better Google Searches

💡 Prelude: I collected some common advanced keywords for Google searching. These tips are generally applicable to most search engines. You can also “search” on this page to find what you need. Exact Keywords Use "key words ..." (double quotes) to prevent keywords from being split up during the search. Exclude Keywords Use - to exclude keywords. For example:python usage -w3s Wildcard The * in the search bar works similarly to the wildcard in Linux. ...

2026-09-10

Choose your licenses

🔔 Prelude: I sometimes wonder if adding a license to my campus homework is too serious. Nevertheless, I still will add it. 🖋️ Main License Version Include License Include Source Code Trademark Status Change Commercial Use Distribution Modification Patent Right Private Use License Transfer No Liability No Trademark Apache License 2.0 Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes FreeBSD License Yes Yes Yes Yes Yes Yes Yes 2-Clause BSD License Yes Yes Yes Yes Yes Yes Yes GNU General Public License(GPL) 2.0 Yes Yes Yes Yes Yes Yes Yes No Yes GNU Lesser General Public License 2.1 Yes Yes Yes Yes Yes Yes Yes No Yes GNU General Public License 3.0 Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes GNU Lesser General Public License 3.0 Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes MIT License Yes Yes Yes Yes Yes Yes Yes Yes Mozilla Public License(MPL) 2.0 Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Eclipse Public License 1.0 Yes Yes Yes Yes Yes Yes Yes Yes No Yes Affero General Public License 3.0 Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes General Copyright Yes Yes Yes Yes No No Yes No In short? Completely Open Source -> MIT License, BSD License Open Source, But Must Credit the Original Author -> Apache License 2.0 Open Source, Must Use the Same License (Copyleft) -> GPL Allows Commercial Use -> MIT License, BSD License, Apache License 2.0, GPL Allows Closed Source (Can Be Integrated into Proprietary Software) -> MIT License, BSD License, Apache License 2.0 Does Not Allow Closed Source (Must Remain Open Source) -> GPL

2026-09-10